gpt4 book ai didi

c# - 为 Windows 通用应用程序的桌面桥运行 makepri 时出现神秘错误

转载 作者:太空狗 更新时间:2023-10-29 20:33:00 26 4
gpt4 key购买 nike

我一直在尝试使用桌面桥将 WPF 应用程序包装在 Windows 通用应用程序中。

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

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

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

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

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

首先,如果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 元素(在 AppxManifest.xml 的根级别)中删除 IgnorableNamespaces 属性解决的。

--

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

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

"C:\Program Files (x86)\Windows Kits\10\bin\10.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 定义 - 如中所述this article .

关于c# - 为 Windows 通用应用程序的桌面桥运行 makepri 时出现神秘错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44703511/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com