dotnet / maui

.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.
https://dot.net/maui
MIT License
21.9k stars 1.69k forks source link

DEP0700: Registration of the app failed. [0x80080204] error 0xC00CE014: App manifest validation error: The app manifest must be valid as per schema #14564

Open vibol03 opened 1 year ago

vibol03 commented 1 year ago

Description

Error DEP0700: Registration of the app failed. [0x80080204] error 0xC00CE014: 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/foundation/windows10/restrictedcapabilities}Capability' is unexpected according to content model of parent element '{http://schemas.microsoft.com/appx/manifest/foundation/windows10}Capabilities'. Expecting: {http://schemas.microsoft.com/appx/manifest/foundation/windows10}DeviceCapability. MauiApp2

Steps to Reproduce

  1. create a new .NET MAUI project
  2. go to Platforms > Windows > open Package.appxmanifest
  3. Replace
    <Capabilities>
      <rescap:Capability Name="runFullTrust" />
    </Capabilities>

    with

    <Capabilities>
      <DeviceCapability Name="location"/>
    </Capabilities>

Link to public reproduction project repository

n/a

Version with bug

7.0 (current)

Last version that worked well

Unknown/Other

Affected platforms

Windows

Affected platform versions

Windows SDK 10.0.19041 - 22621

Did you find any workaround?

no. I have also tried

<Capabilities xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities">
  <DeviceCapability Name="location" />
</Capabilities>
<Capabilities>
  <uap:DeviceCapability Name="location" />
</Capabilities>
<Capabilities>
  <rescap:DeviceCapability Name="location" />
</Capabilities>
<Capabilities>
  <rescap:Capability Name="location" />
</Capabilities>

none, worked

Relevant log output

nothing else beside the error message. Nothing was generated in the event viewer either.
jfversluis commented 1 year ago

The correct one should be

<DeviceCapability Name="location" />

After changing it make sure that you rebuild your project. Maybe delete the bin/obj folder.

as also seen in this sample app here.

Does that help?

ghost commented 1 year ago

Hi @vibol03. We have added the "s/needs-info" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

vibol03 commented 1 year ago

Hi Gerald, That tag was the first thing that i tried. I have also ran the sample app that you provided. It ran fine, but when i removed <rescap:Capability Name="runFullTrust" />, i get the same error in that sample project. It seems like in MAUI Windows, access to DeviceCapability is not allowed. I have tried the same thing on multiple computers. Please advise.

ghost commented 1 year ago

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment. If it is closed, feel free to comment when you are able to provide the additional information and we will re-investigate.

vibol03 commented 1 year ago

I'm not sure why this bug was closed. I have provided the required feedback since last week. Can someone please advise? thanks

jfversluis commented 1 year ago

Hey @vibol03 this got closed wrongfully it seems, sorry about that. I've been digging into this a little and here is what I found.

If you remove <rescap:Capability Name="runFullTrust" /> and add only <DeviceCapability Name="location" /> (or any other for that matter, it will give the error that you described.

While looking at the docs here. I found this notice

image

This confirmed a hunch I was having... So I decided to not include <rescap:Capability Name="runFullTrust" />, but do include <DeviceCapability Name="location" /> and trigger a build that shows this error.

When I then look in bin\Debug\net7.0-windows10.0.19041.0\win10-x64 I see the generated AppxManifest.xml file and inside of that there is this:

  <Capabilities>
    <DeviceCapability Name="location" />
    <rescap:Capability Name="runFullTrust" />
  </Capabilities>

Going back to the note from the docs just above: this is invalid.

So it seems that somewhere the <rescap:Capability Name="runFullTrust" /> is added back. But I'm not sure if that is something we are doing or Win UI is doing. @mattleibow do you have any idea?

From a quick test it seems that this might be on Win UI, because when I update the dependency for Microsoft.WindowsAppSDK the generated manifest seems to not have this entry anymore, however another error is preventing me from actually running the app so I can't say for sure.

On the main branch (.NET 8), we have already updated the dependency to the latest version so if you are willing and able you might try the .NET 8 preview else I think you're stuck just adding the runFullTrust entry as well. If you do that and add the location one after it, that should work as expected.

Reopening for the time being while we verify these things.

halomakes commented 1 year ago

Just ran into this too. Going to see if ms store will accept it as-is for now.

crui3er commented 1 year ago

jfversluis

Hello. Can you explain how did you update the dependency for Microsoft.WindowsAppSDK? I can not update Microsoft.WindowsAppSDK package version in Visual Studio (MAUI .NET7 project). It said that it's blocked by project. Did you meant that you do update to .NET8. Right? image

crui3er commented 1 year ago

Am I correct that in MAUI .NET7 it's not possible to build a win app without <rescap:Capability Name="runFullTrust" />?

XamlTest commented 1 year ago

Verified this on Visual Studio Enterprise 17.7.0 Preview 2.0. Repro on Windows 11 with below Project: 14564.zip(.NET 7)

dustout commented 8 months ago

@jfversluis I am having the same issue when running on the .net 8 version of MAUI. Are there any updates to this issue? It seems as if runFullTrust is still required.

GlassBeaver commented 5 months ago

I believe this is due to the default entry point for a maui app being set to "Windows.FullTrustApplication". You can verify this in the generated bin\Debug\net8.0-windows10.0.19041.0\win10-x64\AppxManifest.xml The line to look for is <Application Id="App" Executable="YourApp.exe" EntryPoint="Windows.FullTrustApplication"> As an alternative, you can try & set it to UWP by changing EntryPoint to Windows.ApplicationModel.Core.CoreApplication or Windows.UI.Xaml.Application but this will come with its own set of problems as you've now converted your app to UWP, e.g.:

Exception thrown: 'System.Runtime.InteropServices.COMException' in WinRT.Runtime.dll
WinRT information: The Application Object must initially be accessed from the multi-thread apartment.
The application called an interface that was marshalled for a different thread.

The Application Object must initially be accessed from the multi-thread apartment.

The program '[16200] BotGlider.exe' has exited with code 4294967295 (0xffffffff).

This happens on startup when I specifiy Windows.ApplicationModel.Core.CoreApplication. @jfversluis is it possible to run maui apps like this?

voroninp commented 6 days ago

I am getting this error for default project if I set min Windows version to 7.0 or 8.0:

DEP0700: Registration of the app failed. [0x80080204] error 0xC00CE169: App manifest validation error: The app manifest must be valid as per schema: Line 19, Column 48, Reason: '7.0' violates pattern constraint of '(0|[1-9][0-9]{0,3}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5])(.(0|[1-9][0-9]{0,3}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5])){3}'. The attribute 'MinVersion' with value '7.0' failed to parse.

image