" XmlXapResolver"是在wp8中工作,但在WP8.1中不工作,并使用System.Xml添加名称空间""
public static string GetAppAttribute(string attributeName)
{
string attribute;
try
{
XmlReaderSettings settings2 = new XmlReaderSettings
{
XmlResolver = new XmlXapResolver()
};
XmlReaderSettings settings = settings2;
using (XmlReader reader = XmlReader.Create("WMAppManifest.xml", settings))
{
reader.ReadToDescendant("App");
if (!reader.IsStartElement())
{
throw new FormatException("WMAppManifest.xml is missing App");
}
attribute = reader.GetAttribute(attributeName);
}
}