How to add uninstall option in .NET Setup Project?

17,655

Solution 1

You can make shortcut to:

msiexec /uninstall [path to msi or product code]

Solution 2

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.

Share:
17,655
Giovanni Galbo
Author by

Giovanni Galbo

By day I'm a software architect (the type that codes, not the type that draws pictures of clouds. [not that there's anything wrong with that]), by night I dress up like a bat and fight crime. I enjoy discussing software. Join me in the discussion on my blog. Visit Book Gold Mine for free books and lectures. I try to add interesting content when I run into something cool.

Updated on June 22, 2022

Comments

  • Giovanni Galbo
    Giovanni Galbo about 2 years

    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.