vpodans
Posts: 35
Joined: Tue Dec 27, 2011 3:03 pm

Replace uninstaller

We have an MSI package which includes custom actions executed during install and uninstall to configure certain things on install and roll back on uninstall. However we detected a major flaw in custom action script executed on uninstall.

My aim is to fix the MSI (only custom action, all other settings remain the same) and use it to uninstall existing installation (built from buggy MSI).

What I have tried: fix the script and rebuild the MSI. However when I run installer it attempts to upgrade existing installation instead of offering "Repair/Uninstall" dialog like I get when run source MSI file. Is it possible to achieve this without upgrading first?
®
Catalin
Posts: 7492
Joined: Wed Jun 13, 2018 7:49 am

Re: Replace uninstaller

Hello,

That probably happens because you have changed the ProductCode property and now Windows Installer sees your MSI as an upgrade.

The correct approach to this is:

- fix your project (e.g. the custom action)

- rebuild the project

- on the faulty machine, run the correct MSI with the following command:

msiexec /fv <path_to_new_msi>

(if the path contain spaces, enclose the path in between double quote characters)

the /fv command is used to recache the MSI (i.e. replace the faulty Custom Action with the correct one).

Hope this helps!

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
vpodans
Posts: 35
Joined: Tue Dec 27, 2011 3:03 pm

Re: Replace uninstaller

Hello Catlin,
thanks for your fast response!
That probably happens because you have changed the ProductCode property and now Windows Installer sees your MSI as an upgrade.
this may happen since we use Azure DevOps pipelines to build the MSI. It appears it re-generates the product code every time we run the pipeline.

However, I did try it locally: I queried ProductID and UpgradeProduct properties from *installed* app using WMI and copied them to AI project (in Product Details\Product IDs). In this case, if I try to run updated MSI file it fails with error message that same software is already installed.

Thanks for suggestion, will try it!
®
Catalin
Posts: 7492
Joined: Wed Jun 13, 2018 7:49 am

Re: Replace uninstaller

You are always welcome!

Indeed, installing two products having the same ProductCode is not possible. The warning you mentioned will pop up if you try.

That happens because your Product is identified by the Windows OS by its ProductCode and UpgradeCode, not by something else such as name, company, etc.

You can read more about this here:

Product Identification (ProductCode and UpgradeCode)

The ProductCode should be the same for the recache operation I've mentioned, not for installing the new MSI over the old MSI.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
vpodans
Posts: 35
Joined: Tue Dec 27, 2011 3:03 pm

Re: Replace uninstaller

The ProductCode should be the same for the recache operation I've mentioned, not for installing the new MSI over the old MSI.
understood. I have to keep same product ID and upgrade ID in order to re-cache the installer.
®
Catalin
Posts: 7492
Joined: Wed Jun 13, 2018 7:49 am

Re: Replace uninstaller

Hello,

Yes, you should.

Please let me know if you encounter any issues with the proposed solution.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”