Getting Application Version Windows Phone 8
Asked Answered
Z

2

8

I'm following the sample code on MSDN (http://msdn.microsoft.com/en-us/library/windows/apps/windows.applicationmodel.package.id.aspx) to get the current application version in C#

 string buildVersion = Package.Current.Id.Version.Build.ToString();

but it gives me the following error:

'Windows.ApplicationModel.Package.Current.Id' threw an exception of type 'System.NotImplementedException'

anyone know how I can get the app version number?

Zonazonal answered 22/3, 2013 at 19:45 Comment(0)
T
4

That API isn't available: if you look closely at MSDN you'll see that this throws an exception for WP8. You'll have to use the same techniques as for WP7.x.

Namely:

  1. Look up the version number in the manifest.
  2. Look up the version of an assembly.
  3. Wire up a build number of your own.

See https://mcmap.net/q/898798/-wp7-app-version, WP7 - get compile/build date from code?.

Timmytimocracy answered 24/3, 2013 at 6:46 Comment(0)
G
0

for windows phone 8 ..this works..

String version= XDocument.Load("WMAppManifest.xml").Root.Element("App").Attribute("Version").Val‌​ue; 
Golf answered 1/12, 2015 at 6:27 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.