Retreive the version number from Assembly in Windows Phone 7

Have you tried retreiving the version number from the current Assembly  in Windows Phone 7?

You might get the Assembly version in .NET something like this

Version assemblyVersion = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;

From the above assembly snippet , we get the Major , Minor , Build and Revision from the assemblyVersion .

But when you try the same code snippet in Windows Phone 7 , you might get an exception .

Here’s another alternative way to retreive the version number from the current Assembly in Windows Phone 7.

var CurrentAssembly = System.Reflection.Assembly.GetExecutingAssembly().FullName;
string VersionNumber = "Version=  " + CurrentAssembly.Split('=')[1].Split(',')[0];

This should display the version number . Note that i have used the Coding4fun AboutPromt Control as shown in the screenshot below to display the version number from Assembly in Windows Phone 7.

If you enjoyed this post, please consider leaving a comment or subscribing to the RSS feed to have future articles delivered to your feed reader.

3 Comments

  1. George Birbilis November 25, 2011 Reply
  2. George Birbilis November 26, 2011 Reply
    • Senthil Kumar November 26, 2011 Reply

Leave a Reply


x

Interesting BlogPosts to read

How to get an Enumerator from range of elements from ArrayList in C# ?
The code snippet shown in this blog post demonstrates how you can get the enumeraor from a range of ...
How to check for the column name in an SqlDataReader Object in C# ?
When working in ADO.NET for data access , there are times when you want to check to see if a column ...
Download - Pokemon Go for for Windows 10 (Third Party app)
Pokemon Go is one of the popular AR games for android and iOS devices and now , the game is made ava...