Extracting the Assembly Version in .Net
I like to place the version number of the current application either on the console output or the title bar of the Winform. Using the below method I am able to extract the current assemblies information and return the version info to be displayed.
using System.Reflection;
using System.Diagnostics;
~
// Place in local code
Assembly ass = Assembly.GetExecutingAssembly();
string version;
if (ass != null)
{
FileVersionInfo FVI = FileVersionInfo.GetVersionInfo(ass.Location);
version = String.Format("{0} Version ({1:0}.{2:0})",
FVI.ProductName,
FVI.FileMajorPart.ToString(),
FVI.FileMinorPart.ToString());
}
else
{
version = "Unknown";
}
This is really helpful, but I seem to be unable to find the Revision portion of the Assembly version. Am I just missing it, or is it not accessible this way?
Thanks,
William Jones
Ditto what William said. Revision number?