How to get app version in Windows Phone?

In C# one can use System.Version.Assembly to get the version of a running app. However this doesn't appear to exist in Silverlight for Windows Phone. Is there an alternative?


Solution 1:

You can use the GetExecutingAssembly method and the AssemblyName class to find this information.


  var nameHelper = new AssemblyName(Assembly.GetExecutingAssembly().FullName);

  var version = nameHelper.Version;
  var full = nameHelper.FullName;
  var name = nameHelper.Name;

Solution 2:

If you have moved over to Windows Phone 8, you can simply use the newer PackageId class:

var version = Package.Current.Id.Version;