Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add uninstall option in .NET Setup Project?

The .NET Setup project seems to have a lot of options, but I don't see an "Uninstall" option.

I'd prefer if people could "uninstall" from the standard "start menu" folder rather than send them to the control panel to uninstall my app, so can someone please tell me how to do this?

Also, I am aware of non Microsoft installers that have this feature, but if possible I'd like to stay with the Microsoft toolkit.

like image 384
Giovanni Galbo Avatar asked Sep 14 '08 22:09

Giovanni Galbo


2 Answers

You can make shortcut to:

msiexec /uninstall [path to msi or product code]
like image 97
Mladen Janković Avatar answered Nov 01 '22 19:11

Mladen Janković


Setup Projects have a "RemovePreviousVersons" feature that covers perhaps the most compelling use case for uninstall, but it keys off the "Product Code". See MSDN documentation. This "Product Code" doesn't seem to have been very well named, as it needs to be changed every time you update the Version number. In fact, VS2010 prompts you to do so. Unfortunately, neither the Product Code nor the Version number appears in the file properties of the generated .msi file.

This solution suffers from similar limitations with respect to maintainability as the prior suggestion that includes this same inscrutable Product Code in a hard-coded shortcut.

In reality, there don't seem to be any very attractive options here.

like image 27
Jan Hettich Avatar answered Nov 01 '22 17:11

Jan Hettich