为什么我的 Package.appxmanifest 扩展给我验证错误 C00CE014?

Why is my Package.appxmanifest Extension giving me validation error C00CE014?

在新的 Visual Studio 2019 解决方案中,我创建了一个 .Net Core 控制台项目和一个 UWP 项目,我正在使用 Windows 应用程序打包项目对其进行打包。在这个阶段,我能够毫无问题地编译和 运行 所有这些项目。

我的下一个任务是将控制台应用程序的编译输出作为 windows.fullTrustProcess 添加到打包项目的 Package.appxmanifest 中:

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

<Package
  xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
  xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
  xmlns:uap3="http://schemas.microsoft.com/appx/manifest/uap/windows10/3"
  xmlns:desktop="http://schemas.microsoft.com/appx/manifest/desktop/windows10"
  xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities"
  IgnorableNamespaces="uap uap3 desktop rescap">

  <Identity
    Name="7260053b-0cee-406a-a6ce-0842444e35eb"
    Publisher="CN=Publisher"
    Version="1.0.0.0" />

  <Properties>
    <DisplayName>DisplayName</DisplayName>
    <PublisherDisplayName>DisplayName</PublisherDisplayName>
    <Logo>Images\StoreLogo.png</Logo>
  </Properties>

  <Dependencies>
    <TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.0.0" MaxVersionTested="10.0.0.0" />
    <TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.14393.0" MaxVersionTested="10.0.14393.0" />
  </Dependencies>

  <Resources>
    <Resource Language="x-generate"/>
  </Resources>

  <Applications>
    <Application Id="App"
      Executable="$targetnametoken$.exe"
      EntryPoint="$targetentrypoint$">
      <uap:VisualElements
        DisplayName="DisplayName"
        Description="Description"
        BackgroundColor="transparent"
        Square150x150Logo="Images\Square150x150Logo.png"
        Square44x44Logo="Images\Square44x44Logo.png">
        <uap:DefaultTile Wide310x150Logo="Images\Wide310x150Logo.png" />
        <uap:SplashScreen Image="Images\SplashScreen.png" />
      </uap:VisualElements>
    </Application>
  </Applications>

  <Capabilities>
    <Capability Name="internetClient" />
    <rescap:Capability Name="runFullTrust" />
    <rescap:Capability Name="allowElevation" />
  </Capabilities>

  <Extensions>
    <uap3:Extension Category="windows.fullTrustProcess" Executable="MyConsoleApp.exe"/>
  </Extensions>

</Package>

当我尝试构建打包项目时 我收到以下构建错误:

Error APPX0501: Validation error. error C00CE014: App manifest validation error: The app manifest must be valid as per schema: Line 40, Column 6, Reason: Element '{http://schemas.microsoft.com/appx/manifest/uap/windows10/3}Extension' is unexpected according to content model of parent element '{http://schemas.microsoft.com/appx/manifest/foundation/windows10}Extensions'. Expecting: {http://schemas.microsoft.com/appx/manifest/foundation/windows10}Extension, {http://schemas.microsoft.com/appx/manifest/foundation/windows10}ExtensionChoice.

我尝试了 Extensionuap:Extensiondesktop:Extension 的不同组合,它们都给我类似的错误。我相信从根本上说我对 appxmanifest 命名空间的了解还不足以诊断问题。

如何正确声明我的 fullTrustProcess 扩展?

请将 Extensions 放在 Application 块内。

喜欢以下内容:

<Applications>
<Application Id="App" Executable="$targetnametoken$.exe" EntryPoint="$targetentrypoint$">
  <uap:VisualElements ....../>
  </uap:VisualElements>
  <Extensions>
    <desktop:Extension Category="windows.fullTrustProcess" Executable="FullTrust\FullTrust.exe" />
  </Extensions>
</Application>