托管引导程序:提示输入源时失败

Managed Bootstrapper: Failed while prompting for source

我正在我的托管引导程序 (MBA) 中提供 3 个 msi 包。用户可以选择 select 他们想要安装哪些软件包。一切顺利。当用户尝试从控制面板修改安装时,select 来自对话框和原始源 (MBA.exe) 的新包丢失,安装失败并显示以下日志:

[553C:0A88][2016-03-30T16:00:54]w341: Prompt for source of container: WixAttachedContainer, path: D:\work\MBA.Install.Bundle\bin\Debug\MBA.exe<br/>
[553C:0A88][2016-03-30T16:00:54]e054: Failed to resolve source for file: D:\work\MBA.Install.Bundle\bin\Debug\MBA.exe, error: 0x80070002.
[553C:0A88][2016-03-30T16:00:54]e000: Error 0x80070002: Failed while prompting for source (original path 'D:\work\MBA.Install.Bundle\bin\Debug\MBA.exe').
[553C:0A88][2016-03-30T16:00:54]e311: Failed to acquire container: WixAttachedContainer to working path: C:\Users\Me\AppData\Local\Temp\{1338381A-F85F-4B6D-83EA-A0A2D1A369C1}A35D6D6CAC04B3DC248033B1588CBD67AD698B, error: 0x80070002.
[553C:0A88][2016-03-30T16:00:54]i000: CachePackageComplete: Pkg_Id=EMS.Server Resulted=None
[553C:0A88][2016-03-30T16:00:54]i000: CacheComplete: Status=-2147024894
[553C:3C24][2016-03-30T16:00:54]e000: Error 0x80070002: Failed while caching, aborting execution.

我试图在 ResolveSource 事件处理程序中捕获它。 e.LocalSourcee.DownloadSource 是只读属性。没有下载丢失文件的标准,所有文件都需要在本地存在。

我在此处阅读了有关获取原始安装程序源的提示: https://blogs.msdn.microsoft.com/heaths/2007/10/25/resolvesource-requires-source/

但这是关于 msi 安装程序的,而在我的 MBA 中,此对话框被禁止显示。

问题:

  1. 如何手动设置 LocalSource(可能是通过用户的对话框输入)?
  2. 我可以在运行时将 WixAttachedContainer 设置为其他一些工作路径但从用户那里获取输入吗?
  3. 我们可以在运行时设置 Engine.SetLocalSource() 吗?

多谢...

在阅读了其他帖子和来自 Wix-Users 电子邮件列表的一个很好的回复之后,我得到了部分成功的想法:

  1. ResolveSource 事件处理程序中,我调用了 Engine.SetLocalSource()
  2. 然后调用Engine.Detect()

这将重置所有搜索等,并会在 e.LocalSource 中重新启动具有更新路径的 Add/Remove/Uninstall/Repair 会话。现在一切正常。

其余的是,我不得不努力隐藏会话的重新启动并从用户选择新组件(或者如果取消选择任何组件)的地方继续屏幕,即我猜 PlantAction(LaunchAction.Install)

我几乎弄清楚了它会被注入到哪里,只需要再次淹没到代码中(实际上是它的 MVVM :( )

这可能是 WiX 工具集中的错误 - 请参阅 https://github.com/wixtoolset/issues/issues/5586

  1. 覆盖或挂钩 ResolveSource 事件。
  2. 使用 SetLocalSource()
  3. 更改容器的 LocalSource
  4. 将事件的Result设为Result.Retry

参见以下示例:

    private void OnResolveSource(object sender, ResolveSourceEventArgs e)
    {
        var wixBundleOriginalSource = Application.Engine.StringVariables["WixBundleOriginalSource"];

        Application.Engine.Log(LogLevel.Verbose, $"Setting local source for {e.PackageOrContainerId} to '{wixBundleOriginalSource}' (WixBundleOriginalSource)");
        Application.Engine.SetLocalSource(e.PackageOrContainerId, e.PayloadId, wixBundleOriginalSource);

        Application.Engine.Log(LogLevel.Verbose, $"Retry to resolve source for {e.PackageOrContainerId}");
        e.Result = Result.Retry;
    }