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?
-
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.
-
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 useIsNetworkDeployed
to only retrieve the version info when you run from the published location. -
With .NET 3.0 I'm using
Version ver = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.