【问题标题】:The Appx package's manifest is invalid. (Exception from HRESULT: 0x80080204)'Appx 包的清单无效。 (来自 HRESULT 的异常:0x80080204)'
【发布时间】:2021-03-27 07:47:51
【问题描述】:

我正在尝试在 Visual Studio 中运行一个包,其中包括一个 UWP 和一个控制台。我在以下几行中收到“Appx 包的清单无效。(来自 HRESULT 的异常:0x80080204)”:

    private async void OnLoad(object sender, RoutedEventArgs e)
    {
        if (ApiInformation.IsApiContractPresent("Windows.ApplicationModel.FullTrustAppContract", 1, 0))
        {
            await FullTrustProcessLauncher.LaunchFullTrustProcessForCurrentAppAsync();
        }

    }

在最后一个右括号上。 Windows 10 和 Visual Studio 在我的计算机上是最新的。

这是应用清单:

<?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:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities"
  IgnorableNamespaces="uap rescap">

  <Identity
    Name="6d600000-922a-4cd3-8f19-a6afc21809f9"
    Publisher="CN=11031121"
    Version="1.0.0.0" />

  <Properties>
    <DisplayName>WapProjTemplate2</DisplayName>
    <PublisherDisplayName>11031121</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="WapProjTemplate2"
        Description="WapProjTemplate2"
        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" />
  </Capabilities>
</Package>

【问题讨论】:

  • 能否请您提供一些关于清单中包装的详细代码?
  • 好的,我刚刚编辑了帖子

标签: c# visual-studio uwp


【解决方案1】:

当您使用 FullTrustProcessLauncher 类时,您需要在 Package 清单中添加 windows.fullTrustProcess Extensions。

例如:

  <Applications>
    <Application Id="App"
      Executable="$targetnametoken$.exe"
      EntryPoint="$targetentrypoint$">
      ……

        <Extensions>
            <desktop:Extension
              xmlns:desktop="http://schemas.microsoft.com/appx/manifest/desktop/windows10"
              Category="windows.fullTrustProcess"
              Executable="MyConsole/MyConsole.exe" />
        </Extensions>
        
    </Application>
  </Applications>

注意,MyConsole(替换你的Console项目名称)是Console项目的名称。您需要先运行控制台项目。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-04-09
    • 2010-10-01
    • 1970-01-01
    相关资源
    最近更新 更多