传递从引导程序参数,MSI捆绑包参数、程序、MSI

2023-09-03 03:15:29 作者:朕有持无恐

我使用VS2010和维克斯3.6创建MSI包,并将它们捆绑到引导程序设置。这是我的Boostrapper code。

I'm using VS2010 and WiX 3.6 to create MSI packages and bundle them into Bootstrapper setup. Here's my Boostrapper code.

<?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>

MSI包必须以运行指定的参数。通常情况下,我会叫Packag21.msi参数1 = 1参数2 = 2。当我建这个项目,我尝试将参数传递给我的Bootstrapper.exe以同样的方式 Bootstrapper.exe参数1 = 1参数2 = 2 ,但它似乎并不将它们传递给MSI。安装时会在缺少的参数条件。

The MSI packages must have the parameters specified in order to run. Normally, I would call "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. Installations hang with the missing parameters condition.

有没有办法从EXE到MSI?

Is there a way to pass the parameters from the exe to the msi?

推荐答案

这是目前标准的引导程序不可用: WixStdBa不会使现有的命令行特性 - ID:3489809

That is currently not available in the standard bootstrapper: WixStdBa doesn't make the commandline properties available - ID: 3489809

如果你创建自己的引导程序的应用程序可以实现这样的功能。

You can implement such functionality if you create your own bootstrapper application.

编辑: 虽然你不能将参数传递给通过命令行的引导程序,你仍然可以收集到的信息在你的引导程序不同的方式:

Although you can't pass the parameters to your bootstrapper via command line, you can still collect the information in your bootstrapper various ways:

例如:设置一个变量

<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"/>