我花了一秒钟才找到这个,但我相信这就是你要找的:
using System;
using System.Reflection;
public class VersionNumber
{
public static void Main()
{
System.Reflection.Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly();
Version version = assembly.GetName().Version;
Console.WriteLine ("Version: {0}", version);
Console.WriteLine ("Major: {0}", version.Major);
Console.WriteLine ("Minor: {0}", version.Minor);
Console.WriteLine ("Build: {0}", version.Build);
Console.WriteLine ("Revision: {0}", version.Revision);
Console.Read();
}
}
它基于以下站点提供的代码 - http://en.csharp-online.net/Display_type_version_number