Click here to Skip to main content
16,018,534 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i want to handle the event when a windows Application is uninstall using C#

What I have tried:

MyInstaller() : base()
{
   BeforeUninstall += new InstallEventHandler(BeforeUninstallEventHandler);
}
private void BeforeUninstallEventHandler(object sender, InstallEventArgs e)
{
   // Add steps to perform any actions before the Uninstall process.
   Console.WriteLine("Code for BeforeUninstallEventHandler"); 
}
Posted
Updated 27-May-19 22:24pm
Comments
Richard MacCutchan 28-May-19 3:48am    
What is the question?
Member 14369462 28-May-19 8:35am    
how to detect when a Windows Application is uninstalled using C#
Richard MacCutchan 28-May-19 8:48am    
Well that is just a repeat of what you have already written above. You show some code but have not given us any idea of what your problem is.
Liktor Janos 28-May-19 9:29am    
Ok, however it is depends on the context. Do you want to simply do some logging? Or want to prevent to start your uninstaller twice? Are you interested in a specific application uninstaller running state? Or you like to know if ANY uninstaller started by something/someone?
More important, you like to modify your own code, or like to hook up on installer process belongs to someone.
I have a few idea, althought you should fill in more details if I may ask :)

1 solution

 
Share this answer
 
Comments
Liktor Janos 30-May-19 7:18am    
Overriding the Uninstall method simply enable your code to run instead of the original Uninstall method. I think the original question is about detect starting of any OTHER uninstalling process (not your program, but any other that is not based on your code and executable) and do some operation. Of course it would be helpful to know what was the true intention of Member 14369462
RickZeeland 30-May-19 13:37pm    
Thanks for clearing things up! we will see what the OP wants.

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