2

I have an XBAP currently published on my local machine, which has an 'About' canvas build into the XMAL, of which I want to show the published version number, but I can only seem to get the assembly version number. Any suggestions?

starblue
  • 55,348
  • 14
  • 97
  • 151
William Troup
  • 12,739
  • 21
  • 70
  • 98

3 Answers3

3

First make sure you add the following assembly to your project references: System.Deployment. Then you can access the current version like this:

using System.Deployment.Application;

... 

if (ApplicationDeployment.IsNetworkDeployed)
    VersionTextBlock.Text = 
       ApplicationDeployment.CurrentDeployment.CurrentVersion.ToString();

CurrentDeployment is null when you debug locally, so you can use IsNetworkDeployed to only retrieve the version info when you run from the published location.

Anthony Brien
  • 6,106
  • 7
  • 43
  • 56
1

With .NET 3.0 I'm using

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

Hugo
  • 11
  • 1
0

I've seen somewhere saying to use:

System.Deployment.ApplicationDeployment.CurrentVersion

But when using System.Deployment there appears to be no System.Deployment.ApplicationDeployment available to be accessed!

This may not be a solution but may point in the right sort of direction. If someone uses this already maybe they can shed some more light on the matter.

LeeC
  • 135
  • 2
  • 7