How to Get the Windows Phone App version from WMAppManifest file ?

This blog post will explain how to get the Windows Phone App version from the WMAppManifest file using C# in Windows Phone 8.

The WMAppManifest file contains the configurations items related to the Windows Phone app. It includes the following tabs
– Application UI
– Capabilities
– Requirements
– Packaging

The Packaging tab contains the Version Number of the App.

image

How to Get the Windows Phone App version from WMAppManifest file ?

The WMAppManifest file is just an XML file and hence we can use the XDocument class to retreive this element from the file.

Below is a sample code snippet which retreives the App version number from WMAppManifest.xml using XDocument.

private void Button_Click_1(object sender, RoutedEventArgs e)
{
  string appVersionNumber = XDocument.Load("WMAppManifest.xml")
         .Root.Element("App").Attribute("Version").Value;
  MessageBox.Show(appVersionNumber);
}

image

    1 Comment

Leave A Reply

Your email address will not be published. Required fields are marked *

You May Also Like

In this post, you’ll learn about the Win32 Error “0x000019E5 – ERROR_COULD_NOT_RESIZE_LOG” that you get when debugging system erors in...
In this post, you’ll learn about the error “CO_E_DBERROR 0x8004E02B” that is returned when working with COM based APIs or...
In this post, you’ll learn about the Win32 Error “0x000019D0 – ERROR_LOG_BLOCK_VERSION” that you get when debugging system erors in...