Start application after installation using WiX/Burn

Fetchez la vache picture Fetchez la vache · Oct 10, 2012 · Viewed 12k times · Source

I'm aware of similar questions in WiX MSI, but I'm having issues starting an application within a bootstrapper EXE file created with Burn after the installation. My full bundle is below.

If it makes any difference to the scenario, the bootstrapper is started in passive mode, so the user shouldn't need to press anything.

<?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 Company AutoUpdater"
            Version="1.0.11"
            Manufacturer="My Company"
            UpgradeCode="--GUID--">

        <BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.HyperlinkLicense">

            <bal:WixStandardBootstrapperApplication SuppressOptionsUI="yes"
                                                    LicenseUrl=""
                                                    LogoFile="logo.png" />
        </BootstrapperApplicationRef>

        <Chain>
            <MsiPackage SourceFile="..\App1\bin\Release\App1.msi" />
            <MsiPackage SourceFile="..\App2\bin\Release\App2.msi" />
        </Chain>
    </Bundle>

    <Fragment>
        <Property Id="WixShellExecTarget" 
                  Value="[#C:\Program Files (x86)\My Company\App1.exe]" />

        <Binary Id="MyCA"
                SourceFile="[#C:\Program Files (x86)\My Company\App1.exe]"/>

            <CustomAction Id="LaunchApplication"
                          BinaryKey="MyCA"
                          ExeCommand="-switch"
                          Execute="deferred"
                          Return="check"
                          HideTarget="no"
                          Impersonate="no" />

            <InstallExecuteSequence>
                <Custom Action="LaunchApplication" 
                        After="InstallFiles" />
            </InstallExecuteSequence>
    </Fragment>
</Wix>

Answer

levarius picture levarius · Oct 11, 2012

You can add a variable to your Bundle called "LaunchTarget" with a path to the executable you want to run:

<Variable Name="LaunchTarget" Value="[InstallFolder]\path\to\file.exe"/>

After the install, the Setup Successful screen will display a "Launch" button that will start your app.