The Appx package's manifest is invalid. (Exception from HRESULT: 0x80080204)'

0

I am trying to run a Package in Visual Studio which includes a UWP and a Console. I get a "The Appx package's manifest is invalid. (Exception from HRESULT: 0x80080204)" on the following lines:

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

    }

on the last closing bracket. Windows 10 and Visual Studio are up-to-date on my computer.

Here is the App manifest:

<?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
asked on Stack Overflow Dec 16, 2020 by mrao • edited Dec 17, 2020 by mrao

1 Answer

1

You need to add a windows.fullTrustProcess Extensions in your Package manifest when you are using the FullTrustProcessLauncher class.

For example:

  <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>

Note, MyConsole(replace your Console project name) is the name of Console project. You need to run your console project first.

answered on Stack Overflow Dec 18, 2020 by YanGu

User contributions licensed under CC BY-SA 3.0