Python 2.7 如何将变量从python脚本传递到wix?

Python 2.7 如何将变量从python脚本传递到wix?,python-2.7,wix,Python 2.7,Wix,我有一个python脚本,它有一个变量“var”,包含wix创建msi所需的库文件路径。我需要将此“var”发送到wix项目。我如何通过? 我的wix代码看起来有点像这样 <Component Id='MainExecutable' Guid='*'> <File Id='ExecutableFile' Name='mc.exe' DiskId='1' Source='c:\my path to\mc.exe'KeyPath='yes'/> </Component&

我有一个python脚本,它有一个变量“var”,包含wix创建msi所需的库文件路径。我需要将此“var”发送到wix项目。我如何通过? 我的wix代码看起来有点像这样

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


文件id中的源路径应来自python脚本中的“var”。

以下内容将在WiX v3.6中使用+

<Component Id='MainExecutable'>
  <File Id='ExecutableFile' Source='$(var.VariableNameForPath)\mc.exe' KeyPath='yes'/>
</Component>
或者,如果使用MSBuild和.wixproj,则通过
DefineConstants
属性传递值,如:

<PropertyGroup>
  <DefineConstants>VariableNameForPath=C:\my path to</DefineConstants>
</PropertyGroup>
<PropertyGroup>
  <DefineConstants>VariableNameForPath=C:\my path to</DefineConstants>
</PropertyGroup>
<PropertyGroup>
  <DefineConstants>VariableNameForPath=$(MsbuildPropertyForPath)</DefineConstants>
</PropertyGroup>