2013-03-22 65 views
0

我有一个脚本,让我的产品给一个变量“的ProductVersion”的IE版本号期间在威克斯动态改变产品版本,如何每个MSI创建

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

我想通过这个变量“ PRODUCTVERSION'作为wix的msbuild属性。下面是我试过,但有一个错误结束了他说的代码,

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脚本获得的版本号。请帮我找到一个解决方案。

回答

2

documentation表明对于ProductVersion Light期望的格式为x.x.x.

如果你希望得到您的MSI与版本命名的,我一直使用的生成后命令重命名文件,从而...

<Target Name="AfterBuild"> 
    <Copy SourceFiles=".\bin\$(Configuration)\$(OutputName).msi" DestinationFiles=".\bin\$(Configuration)\$(OutputName)_v%(myVersionNumer).msi" /> 
    <Delete Files=".\bin\$(Configuration)\$(OutputName).msi" /> 
    </Target> 
+0

我想PRODUCTVERSION,我发送作为属性wix在%(myVersionNumber)。我将如何使用该? – Aramanethota 2013-03-25 03:58:11

+1

我认为这可能是你之后:http://stackoverflow.com/questions/13233143/anyway-to-create-a-custom-msbuild-property-in-wix-wxs-file – mattyB 2013-03-25 09:08:38

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>