无法使用InstallException取消卸载

时间:2016-06-20 11:53:00

标签: c#

我有一个安装在系统上的C#应用​​程序。我需要通过检查从远程服务器检索的标志来防止其卸载。我使用了InstallException方法,但它没有停止卸载,而是显示Error 1001对话框并卸载应用程序。以下是我正在使用的代码

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

        //Get Flag value from remote server

        if (flag == 0)
        {
           throw new InstallException("Cannot Uninstall");
        }

    }

我无法取消卸载。请帮忙。

0 个答案:

没有答案