Why does the order of items in <Capabilities> of Package.appxmanifest matter?

Theodore Hall 121 Reputation points
2020-10-16T19:26:31.41+00:00

I want to comment on the previous Q&A item, but it's already closed. The accepted answer doesn't work for me.

I see "invalid child element" schema errors for rescap:Capability elements no matter where I put them in the Capabilities list, relative to plain Capability, uap:Capability, and DeviceCapability. I have this for the Package attributes in AppxManifest.xml

<Package
  xmlns          = "http://schemas.microsoft.com/appx/manifest/foundation/windows10"
  xmlns:uap      = "http://schemas.microsoft.com/appx/manifest/uap/windows10"
  xmlns:desktop4 = "http://schemas.microsoft.com/appx/manifest/desktop/windows10/4"
  xmlns:uap10    = "http://schemas.microsoft.com/appx/manifest/uap/windows10/10"
  xmlns:rescap   = "http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities"
  IgnorableNamespaces = "uap desktop4 uap10 rescap"
>

I notice that I can use DeviceCapability with rescap:Capability Name values, but only because there's no schema validity check on the value.

<DeviceCapability Name = "userSystemId"/> ultimately seems to have the desired effect.

Universal Windows Platform (UWP)
{count} votes

Accepted answer
  1. Yan Gu - MSFT 2,676 Reputation points
    2020-10-20T06:00:58.58+00:00

    Hello,
    Welcome to Microsoft Q&A,

    I implemented the Capabilities codes provided by you, and reproduce the "invalid child element" schema error in your screenshot. I checked the order of each Capability and found no problem based on the several Note of the document.

    The green wavy line in the screenshot is just a reminder and does not affect the build and debug of the project and can be ignored. You could directly run your app to see if your app could run correctly.


    If the response is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful