Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove registry key during uninstall

I have a simple C# application that allows users to specify that it should be (or should not be) started with Windows; it does so by setting (or deleting) a registry key (namely, ...\Software\Microsoft\CurrentVersion\Run\MyApplicationHere).

I am using a VS setup project to create the installer for this program. I don't want the installer to create this key; it should only be created when the user selects the option from within the program.

Here is the issue: I would like the uninstaller to delete this key if it exists, preferably without resorting to any sort of hackery; if there is a simple "built-in" solution I would love to hear it. Thanks!

like image 411
Zach Snow Avatar asked Nov 26 '09 03:11

Zach Snow


2 Answers

just right Click on Setup then Select View -> Registry, you can add a registry key to the list. The key has properties (right click -> Properties) AlwaysCreate,DeleteAtUninstall and Transitive keep AlwaysCreate to false, and DeleteAtUninstall to true and Transitive to true as well adn its Done..

like image 195
Kiran Solkar Avatar answered Oct 03 '22 02:10

Kiran Solkar


The Registry table is designed for this:
http://msdn.microsoft.com/en-us/library/aa371168(VS.85).aspx

See especially under the description of "Name":
If the Value column is Null, then the strings shown in the following table in the Name column have special significance.

- The key is to be deleted, if present, with all of its values and subkeys, when the component is uninstalled.

like image 20
William Leara Avatar answered Oct 03 '22 02:10

William Leara