How to add a Uninstall option in Visual Studio Setup project without writing code
Using Visual Studio 2005/2008, you don’t need to write any code to add a uninstall option for a Setup project (Yes I know some people can write code to do it)
1) In the Setup Project –> File System windows –> Right Click “File System on Target machine” –> add a Special Folder, select System Folder;
2) Into this system folder Add a file. Browse for msiexec.exe from local System32 folder and add it. Override default properties of this file as follows:
Condition:=Not Installed (make sure you put ‘Not Installed’ exactly like that, same case and everything),
Permanent:=True,
System:=True,
Transitive:=True,
Vital:=False.
3) Create a new shortcut under the ‘Users Program Menu’, Set Target to the System Folder which you created in the step 1. and point it’s at the msiexec.exe. Rename the shortcut to ‘Uninstall Your Application’. Set the Arguments property to /x{space}[ProductCode].
5) Build the project, ignore warning about the fact that msiexec should be excluded, DONT exclude it or the setup project wont build.
The ‘Not Installed’ condition and Permananet:=True ensure that the msiexec.exe is only placed into the system folder as part of the install IF it doesn’t aready exist, and it is not removed on an uninstall - therefore it;s pretty safe to ignore that warning and just go for it.
(Based on the description from SlapHead)

February 6th, 2009 at 4:58 pm
Thanx ……… Great, It worked perfect.
September 3rd, 2009 at 11:23 am
This method works if the version of the msiexec.exe file inside the package is less than or equal to the one present in the target machine. If not (i.e. using a Vista file in the installer and launching the msi on an XP machine) the installer complains about not being able to upgrade the msiexec.exe, a message box is shown and you have to ignore the error to continue.
To avoid this situation, just use the lowest file version you can find. I added to the installer the msiexec.exe from an XP SP3 machine (4.5.6001.22159) and it seems to work… at least so far…
October 8th, 2009 at 2:07 pm
Hi,
I created a deployment project using visual studio 2005 for our app.
And earlier installer version of this app was created using install shield.
Now, I followed all the steps mentioned in the above thread, but yet exe installed by the installshield does not get uninstalled and when i install my version it shows me multiple instances in the add/remove application folder.
Any help is really appretiated.
Thanks….. S
December 10th, 2009 at 11:34 am
It works with any version of msiexec.exe if the condition is “NOT Installed” (”NOT” is all caps). This way, the installer will not try to upgrade the file.
March 5th, 2010 at 2:35 am
Hi ,
How to uninstall an windows setup application using C# in Microsoft Visual Studio 2005
April 21st, 2010 at 4:34 pm
I’m such a newbie when it comes to all this, thanks for taking the time to write this up, keep them coming! How to add a Uninstall option in Visual Studio Setup project without writing code was a wonderful read.