【发布时间】: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 文件创建不同版本的安装程序。
提前致谢!
【问题讨论】: