Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get the version of a Windows Phone 8.1 app in code?

Is it possible to get the version of the app while it's running?

In a Windows desktop application I can get it as follows:

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

But GetExecutingAssembly() isn't available in Windows Phone 8.1.

Is there another way?

like image 897
DaveDev Avatar asked Nov 30 '22 01:11

DaveDev


1 Answers

This is how:

PackageVersion pv = Package.Current.Id.Version;
Version version = new Version(Package.Current.Id.Version.Major, 
    Package.Current.Id.Version.Minor, 
    Package.Current.Id.Version.Revision, 
    Package.Current.Id.Version.Build);
like image 169
DaveDev Avatar answered Dec 18 '22 10:12

DaveDev