Prevent uninstall in setup project with OnBeforeUninstall

本小妞迷上赌 提交于 2019-12-06 03:44:37
Subbu

Before calling your custom code, call the base.OnBeforeUninstall(savedState) so that registered delegates receive the event thereby allowing your custom code to execute before the uninstall.

protected override void OnBeforeUninstall(IDictionary savedState)
{
    // Add this
    base.OnBeforeUninstall(savedState);

    if (ApplicationIsBusy())
        throw new ApplicationException("Prevent uninstall while application busy.");
}

Make sure that in the setup project you chose the custom action for uninstalling, that s probably your case.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!