【问题标题】:WiX Bootstrapper: How do I set burn variables from the command line?WiX Bootstrapper:如何从命令行设置刻录变量?
【发布时间】:2013-02-07 22:53:18
【问题描述】:

使用 WiX 3.7 和 .NET 4.0。

从命令行运行 WiX 引导程序 EXE 时如何设置刻录变量?

【问题讨论】:

    标签: command-line wix bootstrapper


    【解决方案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
    


    以下是满足上述所有条件的 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> 
    

    【讨论】:

    • 这适用于WixStdBA,但不适用于托管引导程序应用程序。所以奇怪的是从cmdline解析和覆盖变量的逻辑不在burn core中。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-01-27
    相关资源
    最近更新 更多