首页 > 解决方案 > 无法编译 UWP 项目:应用程序包...清单验证错误

问题描述

更新

如下所述Remarks item 3。当我在项目文件的属性 中添加命名空间xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities"和值时,会导致以下错误。recapIgnorableNamespaces="uap mp recap"Package.appmanifest

当我回滚上述两个更改时,错误就消失了。

原帖

[添加上述值仍然存在问题 - 我确实想添加,除非有人提出更好的解决方案]

在我的UWP项目中VS2017,我在文件中收到以下编译错误...\bin\x86\Debug\AppxManifest.xml

验证错误。错误 80080204:应用清单验证错误:应用清单 XML 必须有效:第 2 行,第 427 列,原因:系统错误:-2142175169。

我的 Package.appmanifest 文件

<?xml version="1.0" encoding="utf-8"?>

<Package
  xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
  xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest"
  xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
  xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities"
  IgnorableNamespaces="uap mp recap">

...

...\bin\x86\Debug\AppxManifest.xml 文件

<?xml version="1.0" encoding="utf-8"?>
<Package xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10" xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest" xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10" xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities" xmlns:build="http://schemas.microsoft.com/developer/appx/2015/build" IgnorableNamespaces="uap mp recap build">
  <!--
    THIS PACKAGE MANIFEST FILE IS GENERATED BY THE BUILD PROCESS.

    Changes to this file will be lost when it is regenerated. To correct errors in this file, edit the source .appxmanifest file.

    For more information on package manifest files, see http://go.microsoft.com/fwlink/?LinkID=241727
  -->
....
....

评论

  1. 该错误似乎与IgnorableNamespaces属性中缺少命名空间别名值有关。现在,在Package.appmanifest file它的...IgnorableNamespaces="uap mp recap">. 而在...\bin\x86\Debug\AppxManifest.xml它的IgnorableNamespaces="uap mp recap build">. 所以AppxManifest.xml在 Debug 文件夹中生成了一个带有 alias 的额外命名空间build。但我不知道为什么 Visual Studio 会这样做,尽管我没有在Package.appmanifest文件中声明。
  2. xmlns:rescap="....."在我向文件添加额外的命名空间之前,项目正在编译Package.appmanifest。此外,即使我将xmlns:build="...."命名空间从复制/粘贴Debug\AppxManifest.xml到,Package.appmanifest我仍然会得到完全相同的错误
  3. 我尝试清理解决方案并重新编译但同样的错误。

标签: uwp

解决方案


IgnorableNamespaces我注意到您在属性中有错字:

IgnorableNamespaces="uap mp recap"

应该

IgnorableNamespaces="uap mp rescap"

注意缺少的“s”字符。是“ restricted capabilities ”的缩写


推荐阅读