public void GetFileVersion() { // Get the file version for the notepad. FileVersionInfo myFileVersionInfo = FileVersionInfo.GetVersionInfo("%systemroot%\\Notepad.exe");
// Print the file name and version number. textBox1.Text = "File: " + myFileVersionInfo.FileDescription + '\n' + "Version number: " + myFileVersionInfo.FileVersion; } 你把文件路径改为你应用程序的就可以了。
Application.ProductVersion 属性请参见 Application 类 | Application 成员 | System.Windows.Forms 命名空间 | ProductName | CompanyName | AssemblyVersionAttribute | Application 成员(Visual J# 语法) | C++ 托管扩展编程 要求 平台: Windows 98, Windows NT 4.0, Windows ME, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 系列 语言 C#C++JScriptVisual Basic全部显示 获取与该应用程序关联的产品版本。[Visual Basic] Public Shared ReadOnly Property ProductVersion As String[C#] public static string ProductVersion {get;}[C++] public: __property static String* get_ProductVersion();[JScript] public static function get ProductVersion() : String;属性值 产品版本。备注 通常,版本号显示为“主版本号.次版本号.内部版本号.专用部件号”。
// Get the file version for the notepad.
FileVersionInfo myFileVersionInfo = FileVersionInfo.GetVersionInfo("%systemroot%\\Notepad.exe");
// Print the file name and version number.
textBox1.Text = "File: " + myFileVersionInfo.FileDescription + '\n' +
"Version number: " + myFileVersionInfo.FileVersion;
}
你把文件路径改为你应用程序的就可以了。
还能这样检测??
只要是用.net类库的都行拉
Application 类 | Application 成员 | System.Windows.Forms 命名空间 | ProductName | CompanyName | AssemblyVersionAttribute | Application 成员(Visual J# 语法) | C++ 托管扩展编程
要求
平台: Windows 98, Windows NT 4.0, Windows ME, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 系列
语言
C#C++JScriptVisual Basic全部显示
获取与该应用程序关联的产品版本。[Visual Basic]
Public Shared ReadOnly Property ProductVersion As String[C#]
public static string ProductVersion {get;}[C++]
public: __property static String* get_ProductVersion();[JScript]
public static function get ProductVersion() : String;属性值
产品版本。备注
通常,版本号显示为“主版本号.次版本号.内部版本号.专用部件号”。