简体   繁体   English

将参数从bootstrapper传递到msi bundle包

[英]Pass parameters from bootstrapper to msi bundle package

I'm using VS2010 and WiX 3.6 to create MSI packages and bundle them into Bootstrapper setup. 我正在使用VS2010和WiX 3.6来创建MSI包并将它们捆绑到Bootstrapper设置中。 Here's my Boostrapper code. 这是我的Boostrapper代码。

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
    <Bundle Name="" Version="" Manufacturer="" UpgradeCode="">
        <BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense" />

        <Chain>
              <MsiPackage SourceFile="Package1.msi">
                <MsiProperty Name="PARAM1" Value="[PARAM1]" />
                <MsiProperty Name="PARAM2" Value="[PARAM2]" />
              </MsiPackage>
              <MsiPackage SourceFile="Package2.msi">
                <MsiProperty Name="PARAM1" Value="[PARAM1]" />
                <MsiProperty Name="PARAM2" Value="[PARAM2]" />
              </MsiPackage>
        </Chain>
    </Bundle>
</Wix>

The MSI packages must have the parameters specified in order to run. MSI包必须具有指定的参数才能运行。 Normally, I would call "Packag21.msi PARAM1=1 PARAM2=2" . 通常,我会称之为"Packag21.msi PARAM1=1 PARAM2=2" After I build the project, I try to pass the parameters to my Bootstrapper.exe in the same manner Bootstrapper.exe PARAM1=1 PARAM2=2 , but it doesn't seem to pass them to the MSI. 在我构建项目之后,我尝试以相同的方式将参数传递给我的Bootstrapper.exe Bootstrapper.exe PARAM1=1 PARAM2=2 ,但它似乎没有将它们传递给MSI。 Installations hang with the missing parameters condition. 安装与缺少的参数条件挂起。

Is there a way to pass the parameters from the exe to the msi? 有没有办法将参数从exe传递给msi?

This has now been implemented and it's available as of the Wix 3.6 RC release on May 21. 这已经实现,并且可以在5月21日的Wix 3.6 RC版本中使用。

Here is the general idea of how it works: 以下是它如何工作的一般概念:

<Wix>
<Bundle>
    <Variable Name="CommandLineArg" bal:Overridable="yes"/>
    <Chain>
      <MsiPackage>
        <MsiProperty Name="CommandLineArg" Value="[CommandLineArg]"/>
      </MsiPackage>
    </Chain>
</Bundle>
</Wix>

You have to make a bundle variable that is overridable at the command line and then pass that variable to your msi. 您必须在命令行中创建一个可覆盖的bundle变量,然后将该变量传递给msi。

That is currently not available in the standard bootstrapper: WixStdBa doesn't make the commandline properties available - ID: 3489809 目前在标准引导程序中不可用: WixStdBa不提供命令行属性 - ID:3489809

You can implement such functionality if you create your own bootstrapper application. 如果您创建自己的引导程序应用程序,则可以实现此类功能。

EDIT: Although you can't pass the parameters to your bootstrapper via command line, you can still collect the information in your bootstrapper various ways: 编辑:虽然您无法通过命令行将参数传递给引导程序,但仍可以通过各种方式在引导程序中收集信息:

ex: Setting a variable 例:设置变量

<Variable Name="PARAM1" Value="SomeValue" Persisted="yes" Type="string" />

ex: Searching registry 例如:搜索注册表

<util:RegistrySearch Root="HKLM" Key="Software\SomeProduct" Value="SomeKey" Variable="PARAM1" Result="value"/>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM