views:

32

answers:

1

I have an msi installer (VS2008 set-up project). What I would like to happen, is for the installer to initially detect if the software is already installed on the machine. If it is, then to uninstall that software and then continue the install.

There are a number of properties, such as DetectNewerInstalledVerision, RemovePreviousVersions and ProductCode that seem to imply this is possible. Currently, I have to regenerate the ProductCode each time, and get an additional entry in my installed program list (Control Panel -> Add / Remove Programs).

Is there a way that I can configure the installer to uninstall any previous versions automatically?

A: 

You are correct - it is possible.

Basically, you need to change two properties. First, you need to set RemovePreviousVersions so that what you want will actually happen. Then, in order for an older version to be recognized, you also need to set the Version number with each deployment. Each time you do a release, manually update this number (to a higher number), or have it update automatically with deploy. When the installer runs, it will detect if any of the previously installed versions are a lower number and remove them automatically.

JasCav
Just to make it clear: The version number needs to be incremented in the setup project, not necessarily for the project to be installed. Visual Studio will then also ask to assign a new *ProductCode*, this needs to be confirmed with yes. Also keep in mind, not to change the *UpgradeCode*.
0xA3
Which Version number are we talking about? There are two in the AssemblyInfo class, one for the set-up project and one in the project -> Properties window?
pm_2
@pm_2 - @0xA3 made the correct clarification in that it needs to be incremented in the setup project.
JasCav