How to display the app version on a Windows Phone page
It's not as simple as it may seem to display the current app version in a Windows Phone 7 app. Here you'll see how this can be solved.
In a Windows Phone app there are at least two places where a version number is entered:
- The WMAppManifest.xml file and
- the AssemblyInfo of the main app assembly.
Both numbers should be kept equal.
So what you'll have to do first is keeping the version number in those two places accurate.
Next add a GetVersion() method to the App.xaml.cs code-behind file that reads out the version number:
public static string GetVersion()
var versionAttribute = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyFileVersionAttribute), true).FirstOrDefault() as AssemblyFileVersionAttribute;
if (versionAttribute != null)
Then you can show the version number on a page by setting the text of a TextBlock, e.g. in the constructor of the page:
ApplicationTitle.Text += " Version " + App.GetVersion();
Sample code to this article is contained in the Media: ValueConverterSample.zip sample code for the Collection of Value converters for Windows Phone apps.