Reputation: 693
I have a script where i get the version number of my product to a variable 'PRODUCTVERSION' i.e,
PRODUCTVERSION= subprocess.check_output('svnversion c:\sandbox -n', shell=False)
I want to pass this variable 'PRODUCTVERSION' as a msbuild property to wix. Below is the code which i tried but ending up with an error saying,
light.exe : error LGHT0001: Illegal characters in path.
Here's my script,
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])
where properties in my wix projects is,
<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>
I want to display my output name as 'myapp-2.0.PRODUCTVERSION' ,where PRODUCTVERSION is the version number what i get from my python script.Please help me find a solution for this.
Upvotes: 0
Views: 1668
Reputation: 693
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()
and in the wixproject pass the above arguments as a MSBuild property and in post build,
<Target Name="AfterBuild">
<Copy SourceFiles=".\bin\$(Configuration)\$(OutputName)-$(ProductVersion).msi" DestinationFiles=".\bin\$(Configuration)\$(OutputName)-$(ProductVersion).msi" />
<Delete Files=".\bin\$(Configuration)\$(OutputName).msi" />
</Target>
Upvotes: 0
Reputation: 1104
The documentation suggests that for the ProductVersion Light is expecting something in the format x.x.x.x.
If you want to get your MSI named with the version, I've always used a post-build command to rename the file, thus...
<Target Name="AfterBuild">
<Copy SourceFiles=".\bin\$(Configuration)\$(OutputName).msi" DestinationFiles=".\bin\$(Configuration)\$(OutputName)_v%(myVersionNumer).msi" />
<Delete Files=".\bin\$(Configuration)\$(OutputName).msi" />
</Target>
Upvotes: 2