WiX: how to access / change the installation directory in a managed bootloader?

I am creating a WPF customization application with a user interface. I started with a textbook by Brian P. Johnston: http://bryanpjohnston.com/2012/09/28/custom-wix-managed-bootstrapper-application/

Somewhere in my view, I have a simple TextBox that links to the Property InstallationPath in my MainViewModel .

Now I want this path to be used when the user clicks Install. For this, I have a button that binds to my InstallCommand . The following method is called (taken directly from the textbook):

 private void InstallExecute() { Bootstrapper.Engine.Plan(LaunchAction.Install); } 

How can I make packages to install into the directory of my InstallationPath property?


Edit:

I found a similar question here in Stackoverflow:

Specify SETTING POSITION OF PACKAGES TO WiX INSIDE A BOOT BOOT RECORDED WITH BURN

Reply from Bob Arnson

Use a child MsiProperty for each MsiPackage to specify INSTALLLOCATION = [BurnVariable]. Then use Engine.StringVariables to set BurnVariable.

Now, I think I could access StringVariables in my InstallExecute like this

 private void InstallExecute() { Bootstrapper.Engine.StringVariables["BurnVariable"] = InstallationPath; Bootstrapper.Engine.Plan(LaunchAction.Install); } 

But where to define this variable? I think somewhere in Product.wxs?

+6
source share
2 answers

Yes, just create a variable in your bootloader:

 <Variable Name="BurnVariable" bal:Overridable="yes" /> 

you can pass this as a parameter to your msi boot package:

 <MsiPackage SourceFile="$(var.YourMsiProject.Installer.TargetPath)" Compressed="no"> <MsiProperty Name="INSTALLLOCATION" Value="[BurnVariable]" /> </MsiPackage> 
+8
source

One missing Type property in a Variable Bundle element. caverman_dick is right, but it does not work properly when not overridden. You can also try this by setting Type = "string".

Wix variable element

 <Wix>...<Bundle>... <Variable Name="MyApplicationMsiInstallFolder" Value="[WindowsVolume]MyApplication" bal:Overridable="yes" Type="string"/> <Chain> <?if $(var.DbVersion) = false?> <PackageGroupRef Id="AccessDatabaseGroup"/> <RollbackBoundary /> <?endif?> <MsiPackage Id="MyApplicationMsiPackage" SourceFile="$(var.MyApplicationSetup.TargetPath)" DisplayInternalUI="no" Vital="yes" > <MsiProperty Name="APPLICATIONFOLDER" Value="[MyApplicationMsiInstallFolder]"/> </MsiPackage> </Chain> </Bundle></Wix> 
+1
source

All Articles