Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
309 views
in Technique[技术] by (71.8m points)

.net - 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. 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>

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.

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

This has now been implemented and it's available as of the Wix 3.6 RC release on May 21.

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...