I was wondering what the proper way to get and handle WMAppManifest version is for Windows Phone 8 applications.
Basically, my case is this: I want to implement a check that will not let the user use the app if it is not the latest version. In this case I want to check the version number of the user. Currently I do it like this:
var docRoot = XDocument.Load("WMAppManifest.xml").Root;
string versionString = docRoot.Element("App").Attribute("Version").Value;
string clientString = docRoot.Element("App").Attribute("Title").Value;
However, when I upload the manifest to store a version number is asked upon upgrading the XAP. So my question is, how do I get the version stored in the base and/or will the store update the WMAppManifest automatically so when I upload my package, can I assume for my app manifest (Retrieved by XDocument.Load) to contain the version I entered when uploading it to the store?
The version of your project is stored in the AssemblyInfo.cs
.
This one: [assembly: AssemblyVersion("1.0.0.0")]
You can get assembly information via reflection: System.Reflection.Assembly.GetExecutingAssembly()
(search for the FullName
property).
So you don't have to query the WMAppManifest (and really shouldn't). The version number in the WMAppManifest and AssemblyInfo always have to be kept in sync!
The version number which you have to enter in the dashboard is used for the store and not automatically fetched from the manifest.
To sum up, there are 3 places where you have to maintain the version number. But you should always query it from the AssemblyInfo!