0

我有一个脚本,我在其中将产品的版本号设置为变量“PRODUCTVERSION”,即

PRODUCTVERSION= subprocess.check_output('svnversion c:\sandbox -n', shell=False)

我想将此变量“PRODUCTVERSION”作为 msbuild 属性传递给 wix。下面是我尝试过的代码,但最终出现错误消息,

light.exe : error LGHT0001: Illegal characters in path.    

这是我的脚本,

def build(self,projpath):
    PRODUCTVERSION= subprocess.check_output('svnversion c:\sandbox -n', shell=False)
    arg1 = '/t:Rebuild'
    arg2 = '/p:Configuration=Release'
    arg3 = '/p:Platform=x86'
    arg4 = '/p:ProductVersion=%PRODUCTVERSION%'
    p = subprocess.call([self.msbuild,projpath,arg1,arg2,arg3])

我的 wix 项目中的属性在哪里,

<PropertyGroup>
  <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
  <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
  <ProductVersion>$(ProductVersion)</ProductVersion>
  <ProjectGuid>{d559ac98-4dc7-4078-b054-fe0da8363ad0}</ProjectGuid>
  <SchemaVersion>2.0</SchemaVersion>
  <OutputName>myapp.$(ProductVersion)</OutputName>
  <OutputType>Package</OutputType>
  <WixTargetsPath Condition=" '$(WixTargetsPath)' == '' AND '$(MSBuildExtensionsPath32)' != '' ">$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets</WixTargetsPath>
  <WixTargetsPath Condition=" '$(WixTargetsPath)' == '' ">$(MSBuildExtensionsPath)\Microsoft\WiX\v3.x\Wix.targets</WixTargetsPath>
  <WixVariables>Version=$(ProductVersion)</WixVariables>
</PropertyGroup>

我想将我的输出名称显示为 'myapp-2.0.PRODUCTVERSION' ,其中 PRODUCTVERSION 是我从 python 脚本中获得的版本号。请帮我找到解决方案。

4

2 回答 2

2

文档表明,对于 ProductVersion Light 期望 xxxx 格式的内容

如果您想使用版本命名您的 MSI,我一直使用构建后命令来重命名文件,因此...

  <Target Name="AfterBuild">
    <Copy SourceFiles=".\bin\$(Configuration)\$(OutputName).msi" DestinationFiles=".\bin\$(Configuration)\$(OutputName)_v%(myVersionNumer).msi" />
    <Delete Files=".\bin\$(Configuration)\$(OutputName).msi" />
  </Target>
于 2013-03-22T16:32:42.603 回答
0
def build(self,projpath):
    PRODUCTVERSION = subprocess.check_output('svnversion c:\my path\to svn\ -n', shell=False)
    arg1 = '/t:Rebuild'
    arg2 = '/p:Configuration=Release'
    arg3 = '/p:Platform=x86'
    arg4 = '/p:ProductVersion=%s' %(PRODUCTVERSION)
    proc = subprocess.Popen(([self.msbuild,projpath,arg1,arg2,arg3,arg4]), shell=True, 
                    stdout=subprocess.PIPE) 
    while True:
        line = proc.stdout.readline()                        
        wx.Yield()
        if not line: break
    proc.wait() 

并在 wixproject 中将上述参数作为 MSBuild 属性在构建后传递,

<Target Name="AfterBuild">
<Copy SourceFiles=".\bin\$(Configuration)\$(OutputName)-$(ProductVersion).msi" DestinationFiles=".\bin\$(Configuration)\$(OutputName)-$(ProductVersion).msi" />
<Delete Files=".\bin\$(Configuration)\$(OutputName).msi" />
</Target>
于 2013-04-03T04:32:10.390 回答