tags:

views:

129

answers:

2

I have a main product which is installed using Wix and has its own UpgradeCode

In between releases of the main product we sometimes release plug-ins which add or patch some functionality. The plug-ins are packaged in their own Wix generated .msi files with their own UpgradeCodes and generally install addition files is a separate folder from the main product.

I want to create a new version of the main product which includes the functionality which was previously available in a plug-in. A user upgrading to the new version will no longer need the plug-in so it would be nice to uninstall it as part of the upgrade.

Is there a way of making Wix uninstall a product with UpgradeCode2 when it is upgrading product with UpgradeCode1?

===Update after Bob's answer===

I tried multiple Upgrade elements and the Wix code compiles ok but the installer does not work

When I double click the .msi I immediately get an error dialog saying "Unexpected error ... The error code is 2711"

According to Microsoft's Windows Installer Error Messages page, error 2711 means "The specified Feature name ('[2]') not found in Feature table."

The event viewer lists an error for MsiInstaller: "The installer has encountered an unexpected error installing this package. This may indicate a problem with this package. The error code is 2711. The arguments are: {6BEC2276-3211-4E5F-9EF0-2E64B92DE3F4}, , "

The guid is the correct ProductCode for the product I want to uninstall. msiexec /uninstall {6BEC2276-3211-4E5F-9EF0-2E64B92DE3F4} successfully does the uninstall.

I am guessing that the space between the 2 commas after the guid is the "Feature name ('[2]')" that could not be found. I have tried putting this in manually by adding attribute RemoveFeatures="PlugInFeatureId" to the element but still get the same result.

I am missing something to make the installer build the list of features it should remove?

...

<!--Upgrade the main application-->
<Upgrade Id='$(var.UpgradeCode)'>
  <UpgradeVersion OnlyDetect='no' Property='PATCHFOUND'
    IncludeMinimum='yes' Minimum='1.0.1' Maximum='$(var.BuildVersion)' IncludeMaximum='no'/>
</Upgrade>

<!--Remove the old plugin-->
<Upgrade Id='$(var.PluginUpgradeCode)'>
    <UpgradeVersion OnlyDetect='no' Property='REMOVE' IncludeMinimum='yes' Minimum='1.0.0' Maximum='15.0.0' IncludeMaximum='yes'/>
</Upgrade>

<UIRef Id="WixUI_ErrorProgressText" />

<InstallExecuteSequence>
  <FindRelatedProducts  Before="LaunchConditions" />
  <RemoveExistingProducts After="InstallInitialize" />
</InstallExecuteSequence>

A: 

Yes, just add it as a second Upgrade element with the right UpgradeVersion children.

Bob Arnson
Thanks Bob, I tried this and still had problems, I've updated my original question with more details
IanM
Create a verbose log while running the upgrade and you'll be able to see what's happening when RemoveExistingProducts is called.
Bob Arnson
Think I have found the problem, it was usingProperty='REMOVE'. If I change this to Property='ANYTHINGBUTREMOVE" then it works as expected.Thanks for your helpIan
IanM
A: 

I have completed my web site and now it is gone

Patty Gaynor