I had to add this extra little thing to my Burn bootstrapper EXE where I had to enable the user to pass the installation location as a command line argument. So here is how to do it.
First of all in your chain element of the bootstrapper project’s bundle.wxs, add the MsiProperty element which would allow us to pass value to a variable. Below is an example of such element.
<Chain> <MsiPackage SourceFile="Awesome1.msi"> <MsiProperty Name="InstallLocation" Value="[InstallerPath]" /> </MsiPackage> </Chain>
Inside the MSI package’s setup project, add the directory ID to be “InstallLocation” and have it defined as a property as shown below.
<Property id="InstallLocation"/> <Directory Id="TARGETDIR" name="SourceDir"> <Directory Id="InstallLocation" name=""My Program">
Now back in the bundle.wxs file, add the BalExtension name space as shown below.
Now declare the variable which is going to hold the install path that would be passed as a command line argument.
<Variable Name="InstallerPath" bal:Overridable="yes"/>
overridable should be set to yes for all the variables that would get their values from command line arguments. Now just run the EXE passing the value.
BootstrapperSetup.exe /i InstallerPath=G:\
That’s all folks! now you have a bootstrap installer that takes the install path as a command line argument!