【问题标题】:How to prevent wix custom bootstrapper Uninstallation UI from showing in the upgrade process如何防止 wix 自定义引导程序卸载 UI 在升级过程中显示
【发布时间】:2019-05-27 06:12:24
【问题描述】:

我有一个自定义引导应用程序安装程序,它与安装、卸载等正常功能配合良好。但是现在我需要为安装包添加一个升级功能,但它总是在较新的包安装程序的安装过程中显示安装 UI 或卸载 UI。我知道在此过程中应该删除旧版本,但我希望在安装新版本之前删除旧版本,并且卸载过程应该处于静默模式。

我是 Wix 的新手,但我已经阅读了 StackOverflow 中的很多文章,并尝试了大多数相关的解决方案。如以下链接:

How do I detect the currently installed features during a MajorUpgrade using WiX Burn MBA Bundles?

How to perform Wix Upgrade with custom bootstrapper

Wix doesn't remove previous version of burn exe during major upgrade

WiX burn Upgrade shows uninstall UI at the end

不幸的是,它们都不适合我。对burn引擎的调用栈不太了解,所以把代码发到here

在我的代码中,我尝试了以下解决方案:

private void DetectComplete(object sender, DetectCompleteEventArgs e)
{
    if (LaunchAction.Uninstall == WixBA.Model.Command.Action)
    {
    WixBA.Model.Engine.Log(LogLevel.Verbose, "Invoking automatic plan for uninstall");
    WixBA.Plan(LaunchAction.Uninstall);
    }
}


private void BootstrapperApplication_ApplyComplete(object sender, ApplyCompleteEventArgs e)
{
    if (this.model.BootstrapperApplication.Command.Action == LaunchAction.Uninstall && isRelatedBundlePresent) // this will be called in case of Upgrade of the bundle
    {
            CustomBootstrapperApplication.Dispatcher.InvokeShutdown();
    }
}

如果有人可以帮助我检查我的代码,我将不胜感激。下载我的代码后,请将 MsiVersion 参数更改为版本号,并将 ProjectRootDir 参数更改为“Build”文件夹中“ccnetcall-build-language-package.bat”文件中解决方案文件的本地路径,并且然后通过启动 bat 文件创建不同版本的安装程序。

提前致谢!

【问题讨论】:

    标签: wix upgrade burn


    【解决方案1】:

    BootstrapperApplication.Command 结构包含 display 字段,您的 BA 在决定是否显示 UI 时应尊重该字段。

    在旧版本升级期间,该值应为Display.EmbeddedDisplay.None(我忘记了哪个)。

    【讨论】:

    • 非常感谢师父这么快回复我。实际上我可以在日志中获得“显示”字段,我记得升级时是Display.Embedded。但它是一个只读字段,我无法控制它是否显示 UI。换句话说,我不知道如何控制 UI,什么时候应该显示,什么时候应该隐藏。
    • Display 是一个只读字段。 您的代码应查看该字段并选择不显示 UI。
    • 对不起,我有点不解。我知道我的代码应该根据 Display 字段选择不显示 UI,但我不知道如何实现它。是否有任何相关的教程或示例代码?我真的是 wix 的新手,所以请成为我的导演。提前致谢!
    • 我认为使用以下代码后它应该对不显示 UI 有所影响: 1. WixBA.Plan(LaunchAction.Uninstall); 2. CustomBootstrapperApplication.Dispatcher.InvokeShutdown();但它对我不起作用。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-01-31
    • 1970-01-01
    • 2019-09-03
    • 1970-01-01
    相关资源
    最近更新 更多