alfah
alfah

Reputation: 2085

App version from Windows.ApplicationModel.Package.Current - WP8.1

Even though I have an app version set as 3.0.4 both in WMAppManifest as Package.appxmanifest, Windows.ApplicationModel.Package.Current gives me 1.0.0.0

Any clues? This is how I'm trying to retrieve

var myPackage = Windows.ApplicationModel.Package.Current;
var ver = myPackage.Id.Version;
string appVer = string.Format("{0}.{1}.{2}.{3}", ver.Major, ver.Minor, ver.Build, ver.Revision); 

Upvotes: 0

Views: 144

Answers (3)

Milan Aggarwal
Milan Aggarwal

Reputation: 5104

If this is a 8.1 universal app. Go to Package.appxmanifest file and click the packaging tab. There you can verify what values you are passing for Version (Major, Minor,Build,Revision)

Hope this helps.

Upvotes: 0

Igor Kulman
Igor Kulman

Reputation: 16361

If you have WMAppManifest in your project, your app is a Silverlight one, so the best way si to parse the WMAppManifest file and get the version from there, here is a sample: https://github.com/igorkulman/Kulman.WP8/blob/master/Kulman.WP8/Code/ManifestHelper.cs

Upvotes: 1

Freek Nortier
Freek Nortier

Reputation: 780

You can set your app version in the AssemblyInfo.cs file like this :

[assembly: AssemblyVersion("1.0.*")]

To retrieve it do this :

var nameHelper = new AssemblyName(Assembly.GetExecutingAssembly().FullName);
string sMyAppVersion = nameHelper.Version.ToString();

Upvotes: 0

Related Questions