How to get programatically all capablities that enable in manifest for UWP app

二次信任 提交于 2019-12-02 06:53:00

Reading the appxmanifest directly as a XML file is the way to go here. Something like this:

var doc = XDocument.Load("AppxManifest.xml", LoadOptions.None);
var xname = XNamespace.Get("http://schemas.microsoft.com/appx/manifest/foundation/windows10");
var capabilitiesNode = doc.Root.Descendants(xname + "Capabilities").First();

foreach (var capability in capabilitiesNode.Descendants())
{
    Debug.WriteLine(capability.Name + ": " + capability.Attribute("Name").Value);
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!