windows-installer – How to prevent an .msi installer from forcing an uninstall?

Question:

If I create a setup in .msi format and install it on another pc the first time, fine, but if I make some simple change (compile an .exe and put it in the .msi replacing the previous one), and install it on the pc where I already had been installed, a message appears saying that it is necessary to uninstall,

To make matters worse, the message does not help nor does it say how or allow the uninstall to be done automatically, the end user (sometimes very inexperienced) must look for how to uninstall and after uninstalling look for the setup.msi and install it.

The message it says is:

Another version of this product is already installed. Installation of this version can not continue. To configure or remove the existing version of this product, use Add or Remove Programs in Control Panel.

in English:

Another version of this product is already installed. Installation of this version cannot continue. To configure or remove the existing version of this product, use Add/Remove Programs on the Control Panel.

A bit tedious.

This not only happens with the .msi that I generate, it has happened to me with others, so I think it is something inherent to the msi system.

What I would like is that a setup.msi is simply installed and if there is already something installed that it crushes and nothing else.

What is the best way to get a setup.msi to reinstall itself without saying anything about uninstalling?

Answer:

When an installer is created, it is assigned a Guid that identifies it and is entered in the windows registry, if I am not mistaken it should be here

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall[ProductId GUID]

The installer assigns a Product GUID that identifies it, when it is run for the first time the Guid is registered in the registry, a next one will validate that this guid is already present and will show the uninstall dialog.

For a continuous installation you should regenerate the product guid every time you compile a new msi, although be careful because if you then check the "Add or Remove Programs" option, you will surely see the msi installer item repeated.


For example if you use Wix to create installers you can configure it

How To: Generate a GUID

If you use Visual Studio creating a "Setup Project" you can change the ProductCode

Updates to setup projects

Although I wonder, you did not analyze if the creation of the msi allows you to create upgrades? I raise it because I work with Visual Studio and it includes an integrated version of InstallShield that allows you to define updates, perhaps it is the path that you should evaluate.

Doing Upgrades with InstallShield LE

Scroll to Top