Windows 通用应用程序桌面桥的神秘错误 运行 makepri

Mysterious error running makepri for Windows Universal App's Desktop Bridge

我一直在尝试使用 Desktop Bridge 将 WPF 应用程序包装在 Windows 通用应用程序中。

为了使应用程序的任务栏图标不镀层,具有透明背景,我按照可以在各种博客和 MSDN articles/forums 中找到的说明进行操作,例如 this one.

我执行的第一个命令是这两个:

"C:\Program Files (x86)\Windows Kits\bin.0.15063.0\x64\makepri.exe" createconfig /o /cf priconfig.xml /dq en-US
"C:\Program Files (x86)\Windows Kits\bin.0.15063.0\x64\makepri.exe" new /o /pr . /cf priconfig.xml

这些命令是在 WPF 应用程序的输出文件夹中执行的,我还在其中放置了一个 AppxManifest.xml 文件,以及它引用的文件和文件夹(例如可执行文件和各种资产的图像)尺度和分辨率)。

从这里开始,我得到了两个不同的奇怪错误:

首先,如果AppManifest.xml文件包含以下部分:

<Extensions>
<desktop2:Extension Category="windows.firewallRules">
<desktop2:FirewallRules Executable="app\MyWpfApp.exe">
<desktop2:Rule Direction="in" IPProtocol="TCP" Profile="all" />
<desktop2:Rule Direction="in" IPProtocol="UDP" Profile="all" />
</desktop2:FirewallRules>
</desktop2:Extension>
</Extensions>

那么第二个 makepri 命令将导致以下错误消息:

onecoreuap\base\mrt\tools\indexertool\src\tool\parametermanager.cpp(:908): error PRI175: 0x80080204 -

onecoreuap\base\mrt\tools\indexertool\src\tool\parametermanager.cpp(:318): error PRI175: 0x80080204 -

Microsoft (R) MakePRI Tool

Copyright (C) 2013 Microsoft. All rights reserved.

error PRI191: 0x80080204 - Appx manifest not found or is invalid. Please ensure well-formed manifest file is present. Or specify an index name with /in switch.

然后,如果我删除那个 FirewallRules 部分,一切似乎 运行 都很好 - 至少在我的机器上是这样。

第二,并不总是运行如预期:

当我尝试 运行 完全相同的文件(使用 AppxManifest.xml 的固定版本)和不同机器上的相同命令时,我得到了我以前在第一台机器(在删除 FirewallRules 部分之前)。

知道是什么导致了这些问题吗?构建机器之间可能存在哪些差异会导致第二个问题?我应该寻找什么?

第一个问题已通过从 Package xml 元素中删除 IgnorableNamespaces 属性 解决(在 AppxManifest.xml) 的根级别。

--

关于第二个问题,在就此问题联系微软的支持团队后,这似乎是旧系统上 makepri 工具 运行 中的一个错误:

显然,当 运行 在 Windows Server 2012 R2(可能还有其他版本)上时,makepri 工具命令必须提供另一个 "optional" 参数来说明应用程序的姓名:

"C:\Program Files (x86)\Windows Kits\bin.0.15063.0\x64\makepri" new /o /pr . /cf priconfig.xml /mn AppxManifest.xml /of resources.pri /in "MyAppName"

重要的部分是行尾的 /in "MyAppName" 参数,尽管其他参数也可能很重要。此外,"MyAppName" 必须与 AppxManifest.xml 文件中定义的相同,在该部分:

<Applications>
  <Application Id="MyAppName" ...>
...

可能与解决此问题相关的另一个步骤是确保稍后用于 makeappx 命令的文件映射文件具有 ResourceId[=31= 的正确定义] - 如 this article.

中所述