http://msdn.microsoft.com/en-us/library/system.diagnostics.fileversioninfo.fileversion(v=vs.110).aspx
这应该会给你一些见解。
的 编辑 强>
我没有添加文章中的代码,以为我会在链接丢失之前更新答案:
Imports System Imports System.IO Imports System.Diagnostics Class Class1 Public Shared Sub Main(ByVal args() As String) ' Get the file version for the notepad. ' Use either of the following two commands. FileVersionInfo.GetVersionInfo(Path.Combine(Environment.SystemDirectory, "Notepad.exe")) Dim myFileVersionInfo As FileVersionInfo = FileVersionInfo.GetVersionInfo(Environment.SystemDirectory + "\Notepad.exe") ' Print the file name and version number. Console.WriteLine("File: " + myFileVersionInfo.FileDescription + vbLf + "Version number: " + myFileVersionInfo.FileVersion) End Sub End Class
在调用DLL之后,为了确保它已加载,您可以使用以下内容从该DLL获取信息(右键单击DLL时会看到的所有内容):
Dim sModule As String For Each tModule As ProcessModule In Process.GetCurrentProcess().Modules sModule = tModule.FileName If sModule.ToUpper.Contains(DLLFileName.ToUpper) Then Dim myFileVersionInfo As FileVersionInfo = _ FileVersionInfo.GetVersionInfo(sModule) DLLFileAndVersion = sModule & " " & myFileVersionInfo.ProductVersion End If Next