2

I am creating my installer msi using WIX. My older application is already installed on machine when I am installing newer version of the application then it removes all files and assembly of older version and put newer version files and assembly but in programs and features of control panel shows both older and newer version.

I am using following code for upgrade

 <Upgrade Id="$(var.UpgradeCode)">
  <UpgradeVersion Minimum="$(var.ProductVersion)" IncludeMinimum="no" OnlyDetect="yes" Language="!(loc.lcid)" Property="NEWPRODUCTFOUND"/>
  <UpgradeVersion Minimum="1.0.0.0" IncludeMinimum="yes" Maximum="$(var.ProductVersion)" IncludeMaximum="no" Language="!(loc.lcid)" Property="UPGRADEFOUND"/>
</Upgrade>

 <CustomAction Id="PreventDowngrading" Error="!(loc.CustomAction_PreventDowngrading)"/>

<InstallUISequence>
  <Custom Action="SetWindowsTypeProp" Before="FindRelatedProducts">1</Custom>
  <!--Custom Action="SetPresenceProperties" After="SetWindowsTypeProp">1</Custom-->
  <Custom Action="PreventDowngrading" After="FindRelatedProducts">NEWPRODUCTFOUND</Custom>
</InstallUISequence>


<InstallExecuteSequence>
  <Custom Action="PreventDowngrading" After="FindRelatedProducts">NEWPRODUCTFOUND</Custom>
  <RemoveExistingProducts Before="InstallInitialize"/>
</InstallExecuteSequence>

Please help me how to remove entry from programs and features

0

1 Answer 1

3

This means your MajorUpgrade isn't working. FindRelatedProducts isn't finding the older version and therefore REmoveExistingProducts isn't working. For recent versions of WiX you can remove a lot of this code and replace it with the newer MajorUpgrade element. It's a higher level abstraction that simplifies much of this authoring.

In order to have a successful MajorUpgrade several things have to happen:

1) Old and New MSI have to have the same UpgradeCode GUID. (Although it's technically possible for an MSI to remove unrelated Products by using additional UpgradeCode properties we'll ignore this for the purpose of this question.)

2) Old and New MSI must have unique ProductCode GUIDs.

3) New MSI must have a higher version ProductVersion property. Please note that only the first 3 numbers are evaluated. ( 1.2.3 -> 1.2.4 works 1.2.3.4 -> 1.2.3.5 does not )

4) Old MSI and New MSI must be installed in the same context ( Per User->Per User or Per Machine -> Per Machine )

5) Upgrade Table must be authored correctly. Use the MajorUpgrade element to assist in this.

4
  • Thanks Christopher, It is working. I have some old version of the application but I do not know their upgrade code so how can we upgrade that application with new one. As you mentioned in point 1 that it's technically possible for an MSI to remove unrelated Products by using additional UpgradeCode properties. Please help me to solve that issue also.
    – Mitul
    Mar 20, 2014 at 5:57
  • Do you have a copy of the old version? If so, look at it using ORCA to get it's UpgradeCode. If not, you need to really examine your CM/Release practices. If you get the upgrade code, author an additional Upgrade element in your new MSI with that UpgradeCode and a suitable version range based on that old version. Mar 20, 2014 at 11:54
  • @ChristopherPainter: I have first 4 point mentioned. What else should i include for point 5. My Upgrade code element is like : <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed."/> After successful update, i see 2 programs in my cntrol panel, v-1.4.8.0 and 1.4.9.0
    – Vandita
    Jun 14, 2017 at 8:44
  • Please email me verbose install.log and upgrade.log Jun 14, 2017 at 16:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.