Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/295.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# Appx包';的清单无效。(HRESULT的例外:0x80080204)和#x27;_C#_Visual Studio_Uwp - Fatal编程技术网

C# Appx包';的清单无效。(HRESULT的例外:0x80080204)和#x27;

C# Appx包';的清单无效。(HRESULT的例外:0x80080204)和#x27;,c#,visual-studio,uwp,C#,Visual Studio,Uwp,我试图在VisualStudio中运行一个包,其中包括一个UWP和一个控制台。我在以下行中得到一个“Appx包的清单无效。(来自HRESULT的异常:0x80080204)”: private async void OnLoad(object sender, RoutedEventArgs e) { if (ApiInformation.IsApiContractPresent("Windows.ApplicationModel.FullTrustApp

我试图在VisualStudio中运行一个包,其中包括一个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>

WapProjTemplate2
11031121
Images\StoreLogo.png

使用该类时,您需要在清单中添加一个
windows.fullTrustProcess
扩展

例如:

  <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
(替换您的控制台项目名称)是控制台项目的名称。您需要先运行控制台项目。

您能为我们提供一些关于清单中打包的详细代码吗?好的,我刚刚编辑了这篇文章