不包含" XmlXapResolver"的定义在Windows Phone8.1中

时间:2015-03-05 09:58:59

标签: c# windows-phone-8.1

" 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);
            }
        }

0 个答案:

没有答案