29

I am developing an installer project using WiX 3.9 toolset. I am trying to uninstall the previous version during the install of a new version. I tried the below one in product.wxs,

<Product Id="*" Name="WIXDemoApp" Language="1033" Version="1.0.0.0" Manufacturer="Man name" UpgradeCode="993d89e6-07ec-4d33-abc5-957360bc66e1">
    <Property Id="PREVIOUSVERSIONSINSTALLED" Secure="yes" />
    <Upgrade Id="89CF8BE7-05EE-4C7E-9EFC-0249DD260EBB">
        <UpgradeVersion
           Minimum="1.0.0.0" Maximum="99.0.0.0"
           Property="PREVIOUSVERSIONSINSTALLED"
           IncludeMinimum="yes" IncludeMaximum="no" />
    </Upgrade>

    <Upgrade Id="89CF8BE7-05EE-4C7E-9EFC-0041DD260EBB">
        <UpgradeVersion
          Minimum="1.0.0.0" Maximum="99.0.0.0"
          Property="PREVIOUSVERSIONSINSTALLED"
          IncludeMinimum="yes" IncludeMaximum="no" />
    </Upgrade>

    <InstallExecuteSequence>
        <RemoveExistingProducts Before="InstallFinalize" />
    </InstallExecuteSequence>
</Product>

I am getting this error:

error LGHT0091: Duplicate symbol 'WixAction:InstallExecuteSequence/RemoveExistingProducts' found. This typically means that an Id is duplicated. Check to make sure all your identifiers of a given type (File, Component, Feature) are unique.`

What was the problem and how do I fix it?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
user2681579
  • 1,413
  • 2
  • 23
  • 50
  • 4
    Make sure you don't reference `RemoveExistingProducts` anywhere else. It might be in another wix authoring, another fragment, etc. – Yan Sklyarenko Nov 17 '14 at 10:31
  • 2
    @YanSklyarenko i have commented the MajorUpgrade() node and now i am not getting the error.Please clarify this also,is it possible to remove more than 1 product during the installation of the new version. – user2681579 Nov 17 '14 at 10:40
  • 18
    The `MajorUpgrade` element does a number of things for you. In particular, it includes the proper scheduling of the `RemoveExistingProducts` action. Hence, adding another `RemoveExistingProducts` element results in the error you faced with initially. And yes, it's possible to remove more than 1 product, see here for details: http://msdn.microsoft.com/en-us/library/aa371197.aspx – Yan Sklyarenko Nov 17 '14 at 11:34
  • 1
    @YanSklyarenko I added another node of Upgrade node with different upgradecode in product.wxs to remove another product during the installation of new version.I have updated the question with that new upgradecode node.I am getting "Duplicate symbol 'Property:PREVIOUSVERSIONSINSTALLED' found." error.Please help me to remove more than 1 product during the installation of new version. – user2681579 Nov 17 '14 at 12:56
  • 1
    The error states that you used the same property in the `@Property` attribute. You should specify a unique name for each `UpgradeVersion` element. – Yan Sklyarenko Nov 17 '14 at 13:06
  • 1
    @YanSklyarenko If the existing product is installed for "all users" it is removing the existing product perfectly.Per user it is not removing the existing version.How to remove the existing version even the existing version is installed as "all users or per users". – user2681579 Nov 17 '14 at 14:43
  • 2
    Windows Installer doesn't allow the installation context (user/machine) to change durin an upgrade. Take a closer look at this for more details: http://msdn.microsoft.com/en-us/library/aa369786.aspx – Yan Sklyarenko Nov 17 '14 at 14:56
  • 6
    @Yan Sklyarenko your answer ought to be the answer... – AndyUK Mar 27 '17 at 08:18
  • 1
    Isn't the upgrade id part duplicated – Code Name Jack Feb 04 '20 at 09:02
  • 1
    @CodeNameJack No, the difference is `0041` and `0249` – Momoro May 07 '20 at 06:13
  • 1
    In my case, I had the same ID in another file. Even though I wasn't using compiling that file or using it in any way, it must have been run sometime in the past, and caused this error. – john k Jun 30 '21 at 16:49

2 Answers2

1

The Upgrade element schedules the RemoveExistingProducts action for you. Remove RemoveExistingProducts from your InstallExecuteSequence and the error should go away. https://wixtoolset.org/documentation/manual/v3/howtos/updates/major_upgrade.html

Upgrade uninstalls detected versions by default. If you only want to store the ids of installed versions in a property add the attribute OnlyDetect="yes". https://wixtoolset.org/documentation/manual/v3/xsd/wix/upgradeversion.html

scaler
  • 417
  • 1
  • 9
0

The most likely problem is, like the error stated, you have a "Duplicate Symbol"


I noticed-- two Properties are labeled PREVIOUSVERSIONSINSTALLED, and another one has an ID also labeled PREVIOUSVERSIONSINSTALLED


WiX could be confusing the two of your Upgrade IDs, seeing as the only difference between them are the numbers 0249 and 0041


Beyond those, your code shouldn't have any problems-- Then again, you didn't provide all of your code, so there is possibly one or more duplicates, like the error said.

Momoro
  • 599
  • 4
  • 23
  • 1
    I had this problem the other day with WiX, and I _hadn't_ figured it out until I saw this answer! I re-checked all of my files, and it turns out I had over _39_ duplicate IDs and names in the entire app! _How could I have been so dumb..?_ Thanks! –  May 07 '20 at 06:20