I have an application whose installer can be delivered in two forms:
- An MSI package; and
- A WiX bundle containing the package along with some chained prerequisites.
Most users will opt to install the bundle, but I want to retain the possibility of manually installing the prerequisites and the MSI package.
My automatic update process involves downloading a new MSI package and doing a major upgrade. This works perfectly as long as the application was originally installed using the MSI package. However, if the application was installed from the bundle I end up with two versions installed side by side.
How can I make sure that an upgrade using a downloaded MSI correctly replaces or removes the original bundle?
Bundle.wxs:
<?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="The Product" Version="!(bind.packageVersion.TheProduct.Msi)" Manufacturer="TheCompany" UpgradeCode="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx">
<BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense">
<bal:WixStandardBootstrapperApplication
LicenseFile="Resources\license.rtf"
LogoFile="Resources\logo.png" />
</BootstrapperApplicationRef>
<Chain>
<PackageGroupRef Id="NetFx451Web" />
<MsiPackage Id="TheProduct.Msi" SourceFile="$(var.TheProduct.Msi.TargetPath)" Vital="yes" Compressed="yes" />
</Chain>
</Bundle>
</Wix>
Product.wxs (the MSI):
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Name="TheProduct" Language="1033" Version="!(bind.fileVersion.TheProduct.dll)" Manufacturer="TheCompany" UpgradeCode="yyyyyyyy-yyyy-yyyy-yyyy-yyyyyyyyyyyy">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perUser" />
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate EmbedCab="yes" />
<UIRef Id="WixUI_Minimal" />
</Product>
<!-- ... snip ... -->
</Wix>