Delete registry key during uninstall

I have a simple C # application that allows users to specify that it should (or should not) run on Windows; he does this by installing (or removing) the registry key (namely ... \ Software \ Microsoft \ CurrentVersion \ Run \ MyApplicationHere).

I am using the VS installation project to create an installer for this program. I do not want the installer to create this key; it should be created only when the user selects a parameter from the program.

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

+3
source share
3 answers

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

See, in particular, the description β€œName”:
If the Value column is Null, the rows shown in the following table in the Name column have a special meaning.

- the key is deleted, if present, with all its values ​​and subsections when the component is deleted.

+2
source

"", "" β†’ "", . ( β†’ ) AlwaysCreate, DeleteAtUninstall Transitive keep AlwaysCreate to false, DeleteAtUninstall - true Transitive Done..

+5

Try creating a custom delete action to delete the key. Not very "built-in", but it's just a couple of lines of code.

0
source

Source: https://habr.com/ru/post/1723959/


All Articles