简体   繁体   中英

Install from WiX bundle, upgrade with MSI results in multiple versions installed

I have an application whose installer can be delivered in two forms:

  1. An MSI package; and
  2. 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>

An .msi package cannot upgrade a bundle; only another bundle can do that. But an .msi package can upgrade an .msi package that was originally installed by a bundle. You're getting two entries in ARP, not two packages installed side-by-side. @Ravi's answer is correct: Use ARPSYSTEMCOMPONENT to ensure that the .msi package isn't visible, to match how the bundle installs it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM