0

I have a python script which has a variable 'var' containing a path to a library file which is required by wix to create a msi. I need to send this 'var' to wix proj.How can i pass? My wix code looks somewhat like this..

<Component Id='MainExecutable' Guid='*'>
<File Id='ExecutableFile' Name='mc.exe' DiskId='1' Source='c:\my path to\mc.exe'KeyPath='yes'/>
</Component>

The Source path in file id should get from 'var' in python script.

1 Answer 1

1

The following will work in WiX v3.6+

<Component Id='MainExecutable'>
  <File Id='ExecutableFile' Source='$(var.VariableNameForPath)\mc.exe' KeyPath='yes'/>
</Component>

To define a variable either pass it on the command-line like:

candle -dVariableNameForPath="C:\my path to" my.wxs

Or if using MSBuild and a .wixproj, pass the value through the DefineConstants property like:

<PropertyGroup>
  <DefineConstants>VariableNameForPath=C:\my path to</DefineConstants>
</PropertyGroup>

Or if you want the C:\my path to to be a property in MSBuild, it'd look like:

<PropertyGroup>
  <DefineConstants>VariableNameForPath=$(MsbuildPropertyForPath)</DefineConstants>
</PropertyGroup>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.