bsa*_*ara 16 command-line wix bootstrapper
使用WiX 3.7和.NET 4.0.
从命令行运行WiX引导程序EXE时,如何设置刻录变量?
bsa*_*ara 33
首先,您希望设置的刻录变量需要设置为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
以下是满足上述所有条件的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>