Programmer
Programmer

Reputation: 400

Read and value from registry and concatenate and finally assign to a variable in wix bootstrapper

I want to launch the application immediately after the installation. My code is as follows

   <Variable Name="LaunchTarget" Value="C:\ProgramFiles\MySetup\MyExe.exe" />

If the user change the installation directory during installation then this code won't work.

My idea is to keep the directory in a registry key during installation (like C:\ProgramFile\UserGiverName) and in the bootstrapper program want to read this value and add the exe name with this registry key value then assign that value to the LaunchTarget variable..

Welcome to any good suggestion regarding this

Upvotes: 1

Views: 1589

Answers (1)

Rob Mensching
Rob Mensching

Reputation: 35911

You can do what you described if you write a custom Bootstrapper Application. However, there isn't anything built into the wixstdba that will read the registry after the chain is applied. I'm guessing your using the wixstdba becasue it has the concept of LaunchTarget built in.

To solve the problem, I would instead, recommend having a variable that stores the install folder (maybe call it InstallFolder) and pass that value from the wixstdba down to the .msi file(s) via a MsiProperty element. Something like:

<!-- Default InstallFolder to something -->
<Variable Name='InstallFolder' Value='[ProgramFilesFolder]MySetup' />

<!-- Pass InstallFolder to the MSI -->
<MsiPackage ...>
   <MsiProperty Name='INSTALLFOLDER' Value='[InstallFolder]' />
</MsiPackage>

Then you can set LaunchTarget to:

<Variable Name='LaunchTarget' Value='[InstallFolder]\MyExe.exe' />

Upvotes: 1

Related Questions