[英]Wix - Managed Bootstrapper Application upgrade problem
I decided to ask my question here because I can't find answer in any other place. 我决定在这里问我的问题,因为在其他任何地方都找不到答案。 My task is to prepare upgrade process with managed bootstrapper UI, but it doesn't want to work properly.
我的任务是使用托管的引导程序UI准备升级过程,但它不想正常工作。 I prepared all of needed MSI packages.
我准备了所有必需的MSI软件包。 I mean I added Product Id="*", I added MajorUpgrade tag and configured it and I change versions between bundle(for test purposes), I also added a few properties which should helps me with distinguish is it an Install, Uninstall or Upgrade process.
我的意思是我添加了产品ID =“ *”,添加了MajorUpgrade标记并对其进行了配置,并且我在捆绑软件之间更改了版本(出于测试目的),我还添加了一些属性,这有助于我区分是安装,卸载还是升级处理。
And my problem starts here, because when I was using default burn UI it worked properly I mean during installation property _INSTALL was set to 1, during upgrade (installing version 2 of bundle) property _UPGRADE was set to 2 and the same with uninstallation, but now when I added Custom UI to that, UPGRADE property isn't set at all. 我的问题从这里开始,因为当我使用默认的刻录UI时,它正常工作是指在安装属性_INSTALL设置为1的过程中,在升级(安装捆绑软件的版本2)期间,属性_UPGRADE设置为2,而卸载的属性相同。现在,当我向其中添加“自定义用户界面”时,根本没有设置UPGRADE属性。 Instead of that during trial of UPGRADE first starts Installation process and it goes to some point and then new window with Uninstallation appears.
而不是在UPGRADE试用期间,它首先开始安装过程,并且到了某个时候,然后出现带有卸载的新窗口。
My question is can I somehow make my Custom UI to behave like a Default UI for burn? 我的问题是,我可以以某种方式使自定义用户界面的行为类似于默认用户界面吗?
Thank you everyone for comments. 谢谢大家的评论。 Inspired by How to perform Wix Upgrade with custom bootstrapper I understood I didn't handle situation when installer is run quietly.
受到如何使用自定义引导程序执行Wix升级的启发,我知道当安装程序安静运行时,我无法处理这种情况。
So I prepared another class for SilentUninstall and did it in my Bootstrapper class: 因此,我为SilentUninstall准备了另一个类,并在我的Bootstrapper类中完成了它:
public class BootstrapperApp : BootstrapperApplication
{
public static Dispatcher Dispatcher { get; set; }
protected override void Run()
{
Dispatcher = Dispatcher.CurrentDispatcher;
var model = new BootstrapperApplicationModel(this);
var command = model.BootstrapperApplication.Command;
if (command.Action == LaunchAction.Uninstall && (command.Display == Display.None || command.Display == Display.Embedded))
{
model.LogMessage("Starting silent uninstaller.");
var viewModel = new SilentUninstallViewModel(model, Engine);
Engine.Detect();
}
else
{
model.LogMessage("Starting installer.");
var viewModel = new InstallViewModel(model);
var view = new InstallView(viewModel);
view.Closed += (sender, e) => Dispatcher.InvokeShutdown();
model.SetWindowHandle(view);
Engine.Detect();
view.Show();
}
Dispatcher.Run();
Engine.Quit(model.FinalResult);
}}
and my SilentUninstaller class: 和我的SilentUninstaller类:
public class SilentUninstallViewModel
{
private BootstrapperApplicationModel model;
private Engine engine;
public SilentUninstallViewModel(BootstrapperApplicationModel model, Engine engine)
{
this.model = model;
this.engine = engine;
WireUpEventHandlers();
}
private void WireUpEventHandlers()
{
this.model.BootstrapperApplication.PlanComplete += PlanCompleted;
this.model.BootstrapperApplication.DetectComplete += DetectCompleted;
this.model.BootstrapperApplication.ApplyComplete += ApplyCompleted;
}
private void DetectCompleted(object sender, DetectCompleteEventArgs e)
{
this.model.LogMessage("Detecting has been completed for silent uninstallation.");
this.model.PlanAction(LaunchAction.Uninstall);
}
private void ApplyCompleted(object sender, ApplyCompleteEventArgs e)
{
this.model.LogMessage("Applying has been completed for silent uninstallation.");
this.model.FinalResult = e.Status;
this.engine.Quit(this.model.FinalResult);
}
private void PlanCompleted(object sender, PlanCompleteEventArgs e)
{
this.model.LogMessage("Planning has been started for silent uninstallation.");
model.ApplyAction();
}
}
and it seems to works properly. 它似乎正常工作。 Even property _UPGRADE is raised in particular MSIs ;)
甚至在特定的MSI中也会引发_UPGRADE属性;)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.