将参数从引导程序传递到 msi 捆绑包 [英] Pass parameters from bootstrapper to msi bundle package
问题描述
我正在使用 VS2010 和 WiX 3.6 创建 MSI 包并将它们捆绑到 Bootstrapper 设置中.这是我的 Boostrapper 代码.
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 PARAM1=1 PARAM2=2"
.构建项目后,我尝试以相同的方式将参数传递给我的 Bootstrapper.exe Bootstrapper.exe PARAM1=1 PARAM2=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" />
例如:搜索注册表
<util:RegistrySearch Root="HKLM" Key="SoftwareSomeProduct" Value="SomeKey" Variable="PARAM1" Result="value"/>
这篇关于将参数从引导程序传递到 msi 捆绑包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!