gpt4 book ai didi

c# - 使用 OnBeforeUninstall 防止在安装项目中卸载

转载 作者:行者123 更新时间:2023-11-30 15:09:35 25 4
gpt4 key购买 nike

我覆盖了 OnBeforeUninstall 以阻止我的应用程序的安装项目在某些情况下卸载它,但它似乎只是没有被调用并且没有任何效果。

protected override void OnBeforeUninstall(IDictionary savedState)
{
if (ApplicationIsBusy())
throw new ApplicationException("Prevent uninstall while application busy.");
}

我可以通过覆盖 Uninstall 方法来取消卸载,但到那时安装项目已经关闭了我的应用程序。当我的应用程序繁忙时,如何在安装项目尝试关闭它并中断我的工作进程之前卸载尝试“失败”?

最佳答案

确保在安装项目中您选择了自定义卸载操作,这可能是您的情况。

关于c# - 使用 OnBeforeUninstall 防止在安装项目中卸载,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4296176/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com