如何使用C#检测何时卸载Windows应用程序 [英] How to detect when a windows application is uninstall using C#

查看:92
本文介绍了如何使用C#检测何时卸载Windows应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在使用C#卸载Windows应用程序时处理该事件



我尝试过:



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"); 
}

推荐答案

您可以覆盖卸载方法:Installer.Uninstall(IDictionary)方法(System.Configuration.Install)| Microsoft Docs [ ^ ]
You can override the Uninstall method: Installer.Uninstall(IDictionary) Method (System.Configuration.Install) | Microsoft Docs[^]


这篇关于如何使用C#检测何时卸载Windows应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆