在玩TestBA Bootstrapper from Bryan时,我首先安装了1.0.0.0。 然后我将版本增加到1.0.0.1并记录该过程。以下是升级期间传递-uninstall -quite命令行的部分:
[2870:21C0][2014-02-24T17:46:38]i300: Apply begin
[1A44:1E54][2014-02-24T17:46:41]i360: Creating a system restore point.
[1A44:1E54][2014-02-24T17:47:15]i361: Created a system restore point.
[1A44:1E54][2014-02-24T17:47:15]i000: Caching bundle from: 'C:\Users\fwaheed\AppData\Local\Temp\{57a07296-0310-4628-971c-2da38aa09f25}\.be\BootstrapperSetup.exe' to: 'C:\ProgramData\Package Cache\{57a07296-0310-4628-971c-2da38aa09f25}\BootstrapperSetup.exe'
[1A44:1E54][2014-02-24T17:47:15]i320: Registering bundle dependency provider: {57a07296-0310-4628-971c-2da38aa09f25}, version: 1.0.0.1
[1A44:2B40][2014-02-24T17:47:16]i305: Verified acquired payload: DummyInstallationPackageId at path: C:\ProgramData\Package Cache\.unverified\DummyInstallationPackageId, moving to: C:\ProgramData\Package Cache\{F1D62AA5-E68C-4B99-A6DD-D7EAE5A1D238}v1.0.0.1\DummyInstaller.msi.
[1A44:1E54][2014-02-24T17:47:16]i323: Registering package dependency provider: {F1D62AA5-E68C-4B99-A6DD-D7EAE5A1D238}, version: 1.0.0.1, package: DummyInstallationPackageId
[1A44:1E54][2014-02-24T17:47:16]i301: Applying execute package: DummyInstallationPackageId, action: Install, path: C:\ProgramData\Package Cache\{F1D62AA5-E68C-4B99-A6DD-D7EAE5A1D238}v1.0.0.1\DummyInstaller.msi, arguments: ' ARPSYSTEMCOMPONENT="1" MSIFASTINSTALL="7"'
[2870:21C0][2014-02-24T17:47:22]i319: Applied execute package: DummyInstallationPackageId, result: 0x0, restart: None
[1A44:1E54][2014-02-24T17:47:22]i325: Registering dependency: {57a07296-0310-4628-971c-2da38aa09f25} on package provider: {F1D62AA5-E68C-4B99-A6DD-D7EAE5A1D238}, package: DummyInstallationPackageId
[1A44:1E54][2014-02-24T17:47:22]i301: Applying execute package: {f1d57671-5e3d-4be7-908f-5a47e72737d9}, action: Uninstall, path: C:\ProgramData\Package Cache\{f1d57671-5e3d-4be7-908f-5a47e72737d9}\BootstrapperSetup.exe, arguments: '"C:\ProgramData\Package Cache\{f1d57671-5e3d-4be7-908f-5a47e72737d9}\BootstrapperSetup.exe" -uninstall -quiet -burn.related.upgrade'
[2870:21C0][2014-02-24T17:48:54]i319: Applied execute package: {f1d57671-5e3d-4be7-908f-5a47e72737d9}, result: 0x0, restart: None
[2870:21C0][2014-02-24T17:48:54]i399: Apply complete, result: 0x0, restart: None, ba requested restart: No
[2870:21C0][2014-02-24T17:48:55]i500: Shutting down, exit code: 0x0
问题:它会显示“卸载”对话框,而不是安静地卸载。如果我单击卸载,它将卸载1.0.0.0然后应用程序将升级到1.0.0.1。
问题:如何让它了解其命令行参数并执行该过程而不显示“卸载”对话框?
我还从Wix 3.7源代码中查询了WixBA项目,但其命令行处理仅处理InstallFolder参数。
我真的很感激任何帮助,因为这个升级方案阻止了我的Bootstrapper项目。
非常感谢。
答案 0 :(得分:6)
关键是选取-quiet
标志,不显示用户界面,而只是执行所请求的操作。
使用DisplayMode
属性通过Bootstrapper基类公开,该属性使用Display
枚举值。选项是
public enum Display
{
Unknown,
Embedded,
None,
Passive,
Full,
}
然后,您可以通过使用Command.Action
枚举的LaunchAction
值(再次在Bootstrapper基类中)确定要执行的操作。选项包括:
public enum LaunchAction
{
Unknown,
Help,
Layout,
Uninstall,
Install,
Modify,
Repair,
}
所以,我使用了一个名为RunningSilent
的自定义属性来检测我不应该显示UI的模式,然后使用它,如下所示:
/// <summary>
/// True if running in silent display mode (ie: no UI).
/// </summary>
public virtual bool RunningSilent
{
get
{
return (DisplayMode != Display.Full && DisplayMode != Display.Passive);
}
}
protected override void Run()
{
if (RunningSilent)
{
Log("Running without UI");
LaunchAction requestedAction = Command.Action;
//... this is an async call, so handle it accordingly.
Engine.Plan(requestedAction);
//... followed by Engine.Apply();
}
else
{
Log("Showing UI window");
//.. Run your Managed UI
}
}
答案 1 :(得分:0)
感谢@John的提示。它在您的提示的帮助下工作。这是我在启动Dialogs(表单视图)之前在Run()中添加的内容:
if (Command.Display != Display.Full && Command.Action == LaunchAction.Uninstall)
{
//MessageBox.Show("Let's do Uninstall silentley ");
MyViewModel.PlanAction(LaunchAction.Uninstall);
}
BTW,就我而言,Command.Display是Display.Embeded,这是预期的行为。
我真的很感激你的提示。再次感谢。