2

I already installed the setup in my PC. Then I made some changes in my code and built the MSI with new one. Now when I tried to install the application I am getting an error as "Another version of the product is already installed please remove the older one".

Instead of displaying this warning, I would like to re-install it. Is this possible?

Cody Gray - on strike
  • 239,200
  • 50
  • 490
  • 574
Developer
  • 8,390
  • 41
  • 129
  • 238

2 Answers2

5

Uninstall the old version, and then re-install the new one.

Otherwise, you'll need to create an installer that is capable of updating your application. The reason is that the ProductCode GUID, which identifies the application about to be installed to Windows, is already in use by the previous instance of your application.

You can specify that your installer remove any previous versions of the application that it finds by setting the RemovePreviousVersions property to True. You'll also need to increment the ProductCode and PackageCode to reflect that this is an upgraded version of the application. You do not want to change the ProductCode if you go this route, because then Windows will see what's about to be installed as an entirely different application. You don't mention what you're using to create the installer, so it's difficult to provide any more details. In Visual Studio, you can set these properties in the designer:

     Visual Studio Deployment Project Properties

Or, if you're using WiX, you should see the answers to this question.

Community
  • 1
  • 1
Cody Gray - on strike
  • 239,200
  • 50
  • 490
  • 574
  • But this is working only when i install through application. But when i go to the SetUp in my release folder and trying it is showing the same error as An Error Occured attempting to install – Developer Dec 22 '10 at 08:04
1

You are getting that message because your PackageCode has changed but your ProductCode hasn't. To install the newer version you'll need to run msiexec /i foo.msi REINSTALL=ALL REINSTALLMODE=vomus. Tools like InstallShield can generate a setup.exe to detect this state and handle it for you.

But I'd like to address a broader concern that I have. You need to understand thoroughly Windows Installer Servicing Strategies. You need to choose what type of upgrades and patches you want to support and test it before you go into production. Additionally you are playing with fire by installing on your own machine without the knowledge needed to mitigate the risks. This is what virtual machine snapshots are for.

Christopher Painter
  • 54,556
  • 6
  • 63
  • 100