21

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?

Yan Sklyarenko
  • 31,557
  • 24
  • 104
  • 139
Tomislav Markovski
  • 12,331
  • 7
  • 50
  • 72

2 Answers2

38

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.

user1513304
  • 381
  • 3
  • 3
  • Now it's work! Thank you [user1513304](http://stackoverflow.com/users/1513304/user1513304). – Dimiano Jul 05 '13 at 15:11
  • Where is the "bal" namespace resolved from? VS inserts the xmlns:bal="" attribute when I type bal:Overridable="yes". – grwww Sep 10 '13 at 20:47
  • @grwww (and for those who come here with the same question) `http://schemas.microsoft.com/wix/BalExtension` – lc. Jan 16 '14 at 00:57
  • 1
    I conditionally install my msi package based on whether the parameter is passed or not. Doing it this way works nicely with the command line but I also want to make the UI work, i.e. when the user initiates the installation with the UI, it doesn't have to worry about the command line argument. How can I make this work, any idea? – randomuser15995183 May 03 '16 at 08:40
5

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.

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"/>
BryanJ
  • 8,485
  • 1
  • 42
  • 61
  • Thank you. The confirmation that this cannot be done is helpful. I posted the same question on the wix-users mailing list and got the same response. – Tomislav Markovski May 09 '12 at 09:35