2013-03-01 80 views
0

我有一个python脚本,它有一个变量'var',其中包含wix创建msi所需的库文件的路径。我需要发送这个'var'给wix proj.How我可以通过吗? 我威克斯代码看起来有点像这个..如何将变量从python脚本传递给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脚本获得。

回答

1

以下将维克斯V3.6工作+

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

要定义一个变量或者将其传递命令行,如:

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

或者,如果使用的MSBuild和.wixproj通过DefineConstants属性一样传递值:

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

或者,如果你想C:\my path to是MSBuild中的一个属性,它看起来像:

<PropertyGroup> 
    <DefineConstants>VariableNameForPath=$(MsbuildPropertyForPath)</DefineConstants> 
</PropertyGroup> 
相关问题