-1

I have already asked this on the microsoft forum but just wanted to expand a little.

We are almost finished migrating our xamarin forms app to .net MAUI. One of the last things that we have to do is setting the correct capabilities in the Package.appxmanifest file. Throughout the whole migration process, we have always been using "runFullTrust" for our windows platform. Now, it is time to copy and paste the correct capabilities from the uwp to .net maui windows. This is what it looks like

<Capabilities>
    <DeviceCapability Name="bluetooth"/>
    <DeviceCapability Name="webcam"/>
  </Capabilities>

The build was fine but when it tried to deploy, it generated this error

Severity Code Description Project File Line Suppression State Error DEP0700: Registration of the app failed. [0x80080204] error 0xC00CE014: App manifest validation error: The app manifest must be valid as per schema: Line 67, 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.

I have also tried selecting those capabilities using the App Manifest Design GUI but it generated the same error.

but nothing seemed to work.

so Basically, i cannot use DeviceCapability Has anyone else gone through this error and have a solution to share?

thanks

Vibol
  • 615
  • 1
  • 8
  • 25

1 Answers1

0

First, the Maui is based on the Winui3 so you may do not need to use the "runFullTrust". You can refer to the comment about the Use partial trust by default for all WinUI 3 apps for more information.

Second, you can check the Publish a .NET MAUI app for Windows. The MSIX package is configured by the Platforms\Windows\Package.appxmanifest (the manifest) file in your project. If you want to use the Restricted capabilities you can follow the approach to declare a restricted capability.

Guangyu Bai - MSFT
  • 2,555
  • 1
  • 2
  • 8
  • i do not want to use to "runFullTrust" I am trying to say that those DeviceCapability tags are literally the only capabilities im trying to declare and it wouldnt let me run the app. I also tried creating a brand new project and removed the "runFullTrust" tag and replace it with ``````. It still wouldnt work. – Vibol Apr 13 '23 at 11:49
  • To declare a restricted capability, modify your app package manifest source file (Package.appxmanifest). Add the xmlns:rescap XML namespace declaration, and use the rescap prefix when you declare your restricted capability. – Guangyu Bai - MSFT Apr 17 '23 at 05:43