1

I am trying to create a package and I was tasked to automate the uninstallation the old version while installing the new one.

I already found the GUID of the old product code and put it as :

msiexec /x {old-product-key} /qb

Now I want to include also the new product code and be able to uninstall it quietly too in the software center.

So what would be the command-line for the uninstallation of the new code as well?

msiexec /x "newfilename.msi" {old-product-key} /qb
dbc
  • 104,963
  • 20
  • 228
  • 340
  • it would be : `msiexec /x {new-product-code} /qb` – Christophe Nov 22 '21 at 13:58
  • So of ever I put this in the command-line, will it uninstall the old product code as the same as i can uninstall it also in the software center? – ChangkyPopz Nov 23 '21 at 14:28
  • Correct me, if I'm wrong. You have two MSI installations, that should be replaced by the new one. If yes, then you could uninstall old versions in the same way as major update. To do it just add `UpgradeCodes` of the old products into `Upgrade` table and ensure that your `ExecuteInstallationSequence` contains `FindRelatedProducts` and `RemoveExistingProducts` actions. Check for possible place of the `RemoveExistingProducts` action (https://learn.microsoft.com/en-us/windows/win32/msi/removeexistingproducts-action ) – Vadim Nov 23 '21 at 14:48
  • Thanks Vadim, Let me try this one out. – ChangkyPopz Nov 24 '21 at 00:47
  • Thanks @Vadim! now I am able to understand regarding about upgrade codes. I want to delve more. Now it works! – ChangkyPopz Nov 24 '21 at 08:04

1 Answers1

0

Major Upgrade: Yes, you need a major upgrade for this. Please read that short first paragraph. In short: a major upgrade is really an install of a new application version combined with the uninstall of the old version - with different uninstall scheduling possible (uninstall old and install new, or install new and uninstall old). It is normally used to deliver new versions of the same application. For example version 2 over version 1. Related products and versions are generally detected via a shared upgrade code. On upgrade codes, packages codes and product codes.

WiX Implementation: You might be using a different tool. However, with regards to WiX: major upgrades used to be done with Upgrade elements, but there is now an easier way to do a normal major upgrade with "sensible defaults" using the MajorUpgrade element:

Basic Sample: Very simple and vanilla WiX MSI with a basic GUI and the required constructs to make a major upgrade work: https://github.com/glytzhkof/WiXDefaultDialogsSample - go up one level for more WiX samples.


Links:

Stein Åsmul
  • 39,960
  • 25
  • 91
  • 164
  • Thank you very much for this helpful. I want to learn about this WIX tool thing. I tried installing it but I cannot see the icon. – ChangkyPopz Dec 02 '21 at 07:50
  • [Perhaps try this messy link list of WiX resources](https://stackoverflow.com/questions/25004226/msi-vs-nuget-packages-which-are-is-better-for-continuous-delivery/25005864#25005864). – Stein Åsmul Dec 02 '21 at 11:24