Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to programmatically uninstall an application in Windows?

We are releasing a new version of our application and we would like it to be able to uninstall the previous installed version from the client's computer.

How would we be able to do that?

edit: I'm installing this application (and also the previous version) with a deployment project in Visual Studio, so I assume it is a Windows Installer.

Thanks a bunch!

like image 826
Alex Avatar asked Dec 21 '22 22:12

Alex


2 Answers

Deployement Project in Visual Studio has a build-in feature to remove previous versions of your application.

Check the "RemovePreviousVersions" property in the Deployement Project Properties.

http://msdn.microsoft.com/library/y63fxdw6.aspx

Edit:

from MSDN:

The installer checks UpgradeCode and ProductCode properties to determine whether the earlier version should be removed. The UpgradeCode must be the same for both versions; the ProductCode must be different.

like image 194
tpol Avatar answered Dec 24 '22 13:12

tpol


If your using batch or another automated deployment tool for your releases, you can easily uninstall an MSI product using the following command line:

 msiexec [/uninstall | /x] [Product.msi | ProductCode]
like image 29
James - built2order Avatar answered Dec 24 '22 11:12

James - built2order