This will be a fairly short but hopefully informative post. In
all of my Windows Phone projects, I always try to get the
client/users as included in the testing as possible. When doing
that it's also very useful to know that they are using the latest
bits of the project or at least understand which version they were
using when they report bugs and change requests. I found a couple
of resources online that I use to have an automatic versioning of
my Windows Phone projects and here it goes:
First you need to read the
post written by Dan Delimarsky and download the simple yet
excellent tool he provides to create the automatic version
increment when building your apps.
Back, done?
Good, then you're almost done! When you have configured your
project and build events according to Dan's article you need to
read the versioning information from within your Windows Phone
application, and that's quite simple.
Add a reference to System.Xml.Ling.dll, you do know how to add a
reference don't you?
The last piece is to read and store the version number
somewhere, the following code is sufficient to get you started:
var xml = System.Xml.Linq.XElement.Load("WMAppManifest.xml");
var appElement = (from manifest in xml.Descendants("App")
select manifest).SingleOrDefault();
if (appElement != null)
{
string version = appElement.Attribute("Version").Value;
}
Now what you do with the string that holds the version is up to
you, it's fairly common to put the number in the About-page or
possibly in the Settings-page.