WiX Burn: Read LaunchTarget from Registry

I am new to WiX and I am trying to start My Bootstrapper my installed application when it is finished. For this I use

<Variable Name="LaunchTarget" Value="path_to_exe"/>

      

However, I am having a hard time getting the path to the executable. The reason for this is because I am using <Chain> to set some prerequisites and then the msi that actually installs my exe.

So, for this, msi directs the path to a known location in the registry, and then the boot file reads it and uses it.

The problem is that when the bootloader reads the registry, msi is not running yet, so it cannot start the executable at the end.

Here's my WiX if it helps:

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:bal="http://schemas.microsoft.com/wix/BalExtension" xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
    <Bundle Name="My Installation" UpgradeCode="a8964402-f3fc-4878-aafd-31ecda6b685e" Version="1.0.0.0">
        <BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense">
            <bal:WixStandardBootstrapperApplication LicenseFile="EULA.rtf"
                                                    ThemeFile="theme.xml"
                                                    SuppressOptionsUI="yes" />
        </BootstrapperApplicationRef>
        <Chain>
            <PackageGroupRef Id="NetFx40Redist"/>
            <ExePackage Id="OpenSSL" SourceFile="pre-requesite.exe" />
            <MsiPackage Id="myInstall" SourceFile="mySetup.msi" />
        </Chain>
        <util:RegistrySearch Root="HKLM"
                             Key="Software\myProgram"
                             Value="myEXEPath"
                             Variable="myEXEPath"
                             Result="value"
                             Format="raw" />
        <Variable Name="LaunchTarget" Value="[myEXEPath]"/>
    </Bundle>
</Wix>

      

So, in short, I am trying to run RegistrySearch AFTER MsiPackage is installed. It can be done? If not, what are my alternatives?

As I note, if I manually fill in the registry value before installing, everything works fine. This means that apart from everything working, everything is working fine.

+3


source to share


1 answer


RegistrySearches are triggered during the Detect operation. Custom BAs can fire Detect after Apply, but this is not really an option since you are using WixStandardBootstrapperApplication.

Luckily for you, WiX v3.9 added support for launching an already running LaunchTarget, requiring the path to the target .exe to be in the registry under HKLM. So, you would do this:

<BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense">
    <bal:WixStandardBootstrapperApplication LicenseFile="EULA.rtf"
                                            ThemeFile="theme.xml"
                                            SuppressOptionsUI="yes"
                                            LaunchTargetElevatedId="MyAEEId" />
</BootstrapperApplicationRef>
<ApprovedExeForElevation Id="MyAEEId" 
                         Key="Software\myProgram" Value="myEXEPath" />

      



Edit:

It looks like you need to install LaunchTarget

. Why doesn't your node know where it will be? You can just put the gibberish on LaunchTarget

(WixStdBA will try to find a place to register first), but you can't use builtins and / or MsiProperty

to find the exe?

+5


source







All Articles