使用WiX的3.7和.NET 4.0。
如何在命令行中运行的WiX的引导程序的EXE时,一组燃烧变量?
Answer 1:
首先,您要设置刻录变量需要设置为Overridable
。 要做到这一点,你必须包括后续的命名空间中的WXS: xmlns:bal="http://schemas.microsoft.com/wix/BalExtension"
如果你正在使用Visual Studio和我一样,你需要包括WixBalExtension.dll
在你的项目引用。 接下来,您需要将以下属性添加到所有要通过命令行来设置刻录变量: bal:Overridable="yes"
。
现在,您可以通过设置以这种方式在命令行中的变量:
BootstrapperSetup.exe /i /passive MyBurnVariable1=1 MyBurnVariable2=2
下面是上面satifies所有的条件中描述的WXS文件的一个例子:
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:bal="http://schemas.microsoft.com/wix/BalExtension">
<Bundle Name="MyProduct" Version="1.0.0" Manufacturer="MyManufacturer" UpgradeCode="PUT-UPGRADE-CODE-HERE">
<BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.HyperlinkLicense">
<bal:WixStandardBootstrapperApplication LicenseUrl="MyLicense.htm" ThemeFile="MyThemeFile.xml" LocalizationFile="MyLocFile.wxl" />
</BootstrapperApplicationRef>
<Variable Name="MyBurnVariable1" bal:Overridable="yes" Type="numeric" Value="0" />
<Variable Name="MyBurnVariable2" bal:Overridable="yes" Type="numeric" Value="0" />
<Chain>
<MsiPackage Id="MyFirstMsiPackage"
SourceFile="first.msi"
InstallCondition="MyBurnVariable1 = 1" />
<MsiPackage Id="MySecondMsiPackage"
SourceFile="second.msi">
<MsiProperty Name="MY_PROPERTY" Value="[MyBurnVariable2]" />
</MsiPackage>
</Chain>
</Bundle>
</Wix>
文章来源: WiX Bootstrapper: How do I set burn variables from the command line?