public static class MainFileVersion
{
public static Version AssemblyVersion
{
get { return ((Assembly.GetEntryAssembly()).GetName()).Version; }
}
public static Version AssemblyFileVersion
{
get { return new Version(FileVersionInfo.GetVersionInfo(Assembly.GetEntryAssembly().Location).FileVersion); }
}
public static string AssemblyInformationalVersion
{
get { return FileVersionInfo.GetVersionInfo(Assembly.GetEntryAssembly().Location).ProductVersion; }
}
}
說明:
AssemblyVersion 程式集的版本例如 1.0.0.0 或 1.0.*
AssemblyFileVersion 程式檔案版本在檔案屬性中可以開到 例如 1.0.0.0
AssemblyInformationalVersion 程式檔案産品版本,格式可以自己定義例如 V1.0 Alpha