WiX Bootstrapper:如何从命令行设置刻录变量? [英] WiX Bootstrapper: How do I set burn variables from the command line?

查看:219
本文介绍了WiX Bootstrapper:如何从命令行设置刻录变量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用WiX 3.7和.NET 4.0。 $ b $bÚ$ b $bÚ
从命令行运行WiX引导程序EXE时如何设置刻录变量?

Using WiX 3.7 and .NET 4.0.

How does one set burn variables when running a WiX bootstrapper EXE from the command line?

推荐答案

首先,需要设置的刻录变量需要设置为 Overridable 。为此,您必须在WXS中包含以下命名空间: xmlns:bal =http://schemas.microsoft.com/wix/BalExtension,如果您使用Visual Studio像我一样,您需要在项目引用中包含 WixBalExtension.dll 。接下来,您需要将以下属性添加到要通过命令行设置的所有刻录变量: bal:Overridable =yes。 $ b $bÚ$ b $bÚ
现在您可以通过命令行以这种方式设置变量:

First of all, the burn variables that you wish to set need to be set as Overridable. To do this you must include the follow namespace in your WXS: xmlns:bal="http://schemas.microsoft.com/wix/BalExtension" and if you're using Visual Studio like me you need to include WixBalExtension.dll in your project references. Next you need to add the following attribute to all of the burn variables that you want to set via the command line: bal:Overridable="yes".

Now you can set the variables via the command line in this fashion:

BootstrapperSetup.exe /i /passive MyBurnVariable1=1 MyBurnVariable2=2



下面是满足上述所有条件的WXS文件的示例:


Below is an example of a WXS file that satifies all of the conditions described above:

<?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:如何从命令行设置刻录变量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆