I have programmed setup with a managed bootstrapper application. In my solution are the following projects: - Setup.msi : The MSI-project to install - Setup.UI.dll : The WPF-GUI for the installation process - Bootstrapper.exe : The bootstrapper-project - Launcher.exe : A WPF-app to start the bootstrapper
In the bootstrapper bundle i have defined a variable for the installationfolder:
<Variable Name="INSTALLFOLDER"
bal:Overridable="yes"
Type="string"
Value="[ProgramFilesFolder]"/>
This variable can be set by the Launcher when starting the bootstrapper:
Process proc = new Process();
proc.StartInfo.FileName = "msiexec";
proc.StartInfo.FileName = "..\\..\\..\\Bootstrapper\\bin\\Debug\\Bootstrapper.exe";
proc.StartInfo.Arguments = "IsClientSetup=true INSTALLFOLDER=C:\\TestSetup";
proc.Start();
In case i'm using the standard bootstrapper (WixStandardBootstrapperApplication.RtfLicense) my given entry will be used in the defined variable INSTALLFOLDER. I see only the bootstrapper dialog while the installation process, but after all everythings fine.
But when i use the managed bootstrapper, which starts my WPF-GUI, and i try to read the installationpath, i always get the default from the definition: the programfilesfolder.
Here the code from the bundle:
<WixVariable Id="WixMbaPrereqPackageId"
Value="Netfx4Full" />
<WixVariable Id="WixMbaPrereqLicenseUrl"
Value="NetfxLicense.rtf" />
<BootstrapperApplicationRef Id="ManagedBootstrapperApplicationHost" >
<Payload Name='BootstrapperCore.config' SourceFile='..\..\..\Setup.UI\bin\Debug\BootstrapperCore.config' />
<Payload SourceFile='..\..\..\Setup.UI\bin\Debug\SetupUI.dll' />
</BootstrapperApplicationRef>
<Chain>
<MsiPackage Id="SetupPackage"
SourceFile="..\..\..\Setup.Msi\bin\Debug\Setup.msi"
Cache="yes"
DisplayInternalUI="no"
Vital="yes"
Compressed="no"
EnableFeatureSelection="no"
DisplayName="SetupForTest">
<MsiProperty Name="INSTALLLOCATION"
Value="[INSTALLFOLDER]" />
</Chain>
And the code from the ViewModel in SetupUI:
string installationPath = UI.Model.Bootstrapper.Engine.FormatString(UI.Model.Bootstrapper.Engine.StringVariables["INSTALLFOLDER"]);
And - at least - the Run-method in the SetupUI:
protected override void Run()
{
MessageBox.Show("1 = " + this.Engine.FormatString(this.Engine.StringVariables["INSTALLFOLDER"]));
Model = new Model(this);
Model.Bootstrapper.Engine.Detect();
MessageBox.Show("2 = " + Model.Bootstrapper.Engine.FormatString(Model.Bootstrapper.Engine.StringVariables["INSTALLFOLDER"]));
RootViewViewModel viewModel = new RootViewViewModel();
View = new RootView(viewModel);
// Populate the view models with data then run the view..
viewModel.Refresh();
View.Run();
this.Engine.Quit(0);
}
Can anybody tell me, what i have made wrong?