WP7 app version

匆匆过客 提交于 2019-12-04 00:52:01
Lukasz Madon

The WmAppManifest.xml number is in use. First two digits are relevant for Marketplace (it is checked when you do the update) next two are for your internal usage.

This is a regular XML file, open it as a XDocument and parse it. An example.

EDIT: the example is extraneous. For just the version, use:

string Version = XDocument.Load("WMAppManifest.xml")
    .Root.Element("App").Attribute("Version").Value;

To get App Version from "WMappManifest.xml", this solution might be a bit more efficient than lukas solution:

For WP7:

var xmlReaderSettings = new XmlReaderSettings
{
    XmlResolver = new XmlXapResolver()
};
using (var xmlReader = XmlReader.Create("WMAppManifest.xml", xmlReaderSettings))
{
    xmlReader.ReadToDescendant("App");
    return xmlReader.GetAttribute("Version");
}

For WP8:

using (var stream = new FileStream("WMAppManifest.xml", FileMode.Open, FileAccess.Read))
{
    string appVersion = XElement.Load(stream).Element("App").Attribute("Version").Value;
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!