2013-03-01 102 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>