wixbootstrapperwix3.11

Can WiX Bootstrapper detect and uninstall previously installed MSI?


I'm creating a simple executable bundle installer with WiX Bootstrapper (using WixStandardBootstrapperApplication) which installs only one MSI and when I run it, install and uninstall work just fine.

I was wondering if it is possible for the bundle installer to detect and uninstall an already installed MSI package? For example, if I install the MSI package as a standalone (not via bundle) and run the bundle installer afterwards, can the bundle installer detect that the MSI is already installed and immediately show the Uninstall dialog?

Looking at the log, when I run the bundle installer it seems that the installed MSI package is detected correctly as Present, but the question is - can we force the bundle installer to go straight to the Uninstall dialog in this case?

Detected package: install_x64, state: Present, cached: None

Here is a simple code example:

Bundle.wxs:

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
    <Bundle Name="BootstrapperExample" Version="1.0.0.0" Manufacturer="test1" UpgradeCode="2f33c6d1-e609-4e78-951d-3402d2388613">
        <BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense" />
        <Chain>
            <MsiPackage  Id="install_x64" SourceFile="C:\test\product1.msi" DisplayInternalUI="yes" Compressed="yes" Visible="yes">
            </MsiPackage>
        </Chain>
    </Bundle>
</Wix>

Product.wxs:

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
    <Product Id="*" Name="product1" Language="1033" Version="1.0.0.0" Manufacturer="test1" UpgradeCode="51804053-BF8C-4DD0-A45F-9F829CF1BE8B">
        <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
        <MediaTemplate />
        <Feature Id="ProductFeature" Title="product1" Level="1">
            <ComponentGroupRef Id="ProductComponents" />
        </Feature>
        <UIRef Id="WixUI_Minimal" />
    </Product>
    <Fragment>
        <Directory Id="TARGETDIR" Name="SourceDir">
            <Directory Id="ProgramFilesFolder">
                <Directory Id="INSTALLFOLDER" Name="product1" />
            </Directory>
        </Directory>
    </Fragment>
    <Fragment>
        <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
            <Component Id="ProductComponent">
                <File KeyPath="yes" Source="C:\test\file1.txt"></File>
            </Component>
        </ComponentGroup>
    </Fragment>
</Wix>

Solution

  • No. There is no support for a bundle to uninstall an MSI that it did not install today.

    An MSI can upgrade another MSIs, which could accomplish what you want in a roundabout sort of way.