wixupgradeuninstallation

Wix ExePackage Side by Side Install without Uninstall


I have two products which I'm trying to write an installer for. Both products are wix bundles which both have a third product bundle as a requirement.

Ideally what I want to happen when you install one is:

So far I was able to conquer some of these points but not all at the same time.

Originally I tried getting the installed version using a ProductSearch and using InstallCommand. However I ran into problems with uninstalling when doing side by side installs because the installcommand is more like "requested install state" and so if I don't want it to install when it detects the same version it actually starts uninstalling it.

I took a look at this similar answer:

How to avoid uninstalling previously installed ExePackage (redistributables) while installing a WiX Bundle?

which suggested using the provideskey and requires elements but I cannot find any useful documentation on them whatsoever. I tried experimenting with it but it doesn't seem to do anything at all.

I've looked at RelatedBundle but I'm not sure it's what I'm after. Seems more targeted at hotfixing systems.

I was hoping there was a way of doing this without having to resort to custom actions since that seems a bit extreme for what seems to be rather simple functionality.


Solution

  • After a lot of trial and error I figured out how to get the DependencyExtension working.

    In the example below ProductC is a Wix Bundle executable. This bundle includes an MSI file. I use a productSearch to look for the upgrade code of that MSI file (NOT THE BUNDLE) to detect if it's already installed.

    In your bundle file for project A and B:

    <Wix xmlns:dep="http://schemas.microsoft.com/wix/DependencyExtension"
         xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
        <Bundle>
            <util:ProductSearch Id="ProductCInstallSearch"
                                UpgradeCode="{ProductC_MSI_UpgradeCode_GUID}"
                                Variable="ProductCInstalled"
                                Result="state"/>
            <dep:Requires Id="ProductCRequired" ProviderKey="ProductC"/>
            <Chain>
                <PackageGroupRef Id="ProductC_pkg"/>
            </Chain>
        </Bundle>
        <Fragment Id="Required_Pkgs">
            <PackageGroup Id="ProductC_Pkg">
                <ExePackage Id="ProductC_Bundle"
                            Permanent="no"
                            DetectCondition="NOT ProductCInstalled = 2"
                            InstallCommand="/quiet"
                            UninstallCommand="/uninstall /quiet">
                    <dep:Provides Key="ProductC"
                                  Version="0.0.0.0">
                        <dep:RequiresRef Id="ProductCRequired"/>
                    </dep:Provides>
                </ExePackage>
            </PackageGroup>
        </Fragment>
    </Wix>
    

    Now you can install A and B in any arrangement and when uninstalling product C will only be removed when the last one is uninstalled.