Click here to Skip to main content
15,886,258 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
I need to remove the program from Windows startup on uninstall.

What I have tried:

Installer.AfterUninstall Event

but i cant use it well
Posted
Updated 18-Sep-16 9:26am
Comments
[no name] 16-Sep-16 10:18am    
Okay... and? Do you have an actual question that you think we can help you with?
john1990_1 16-Sep-16 10:21am    
I want a way in c# to run code when the user uninstalls the app. (to delete it from startup leaving no trace in the startup menu)
Wessel Beulink 16-Sep-16 10:28am    
Than create a msi...
Wessel Beulink 16-Sep-16 10:29am    
Or delete the files which you want to delete
john1990_1 16-Sep-16 10:37am    
how to create an msi?

1 solution

Microsoft ClickOnce technology can do this automatically for you, see these articles:
ClickOnce - Quick steps to Deploy, Install and Update Windows Based Client Applications[^]
and All You Need Is One - A ClickOnce Love Story[^]

The only limitation of ClickOnce is that your application is installed in a safe separate user directory.
But there are ways to circumvent this: http://matijabozicevic.com/blog/wpf-winforms-development/running-a-clickonce-application-as-administrator-also-for-windows-8[^]


The answer above is not what you asked for, I think this will answer your question:
c# - Disable startup program in registry; - Stack Overflow[^]
 
Share this answer
 
v2
Comments
RickZeeland 18-Sep-16 15:35pm    
Oops, I'm afraid I read "Windows Start menu" instead of "Windows startup", but the information might be of interest to you anyway ...
john1990_1 19-Sep-16 16:40pm    
I know how to add or remove program from startup, what i want is when the user uninstalls my program, on uninstall, i run code, the code deletes the program from startup in the way u said and leaves no trace for my program.
RickZeeland 21-Sep-16 13:25pm    
Personally I use Inno Setup which allows scripting (Pascal) in the uninstall section.
But an alternative might be Squirrel: https://github.com/squirrel/squirrel.windows

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900