28
我有一个文件夹中有一些DLL(不是.NET程序集),我想读取它们中的文件信息。像版本,名称等等。最好的方法是什么?从C#读取非.NET DLL版本?
我有一个文件夹中有一些DLL(不是.NET程序集),我想读取它们中的文件信息。像版本,名称等等。最好的方法是什么?从C#读取非.NET DLL版本?
使用FileVersionInfo对象。下面是从Microsoft网站,得到来自NOTEPAD.EXE
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;
}
被盗从here版本信息的例子。
这很好 - 我希望有一个.NET的方式来做到这一点。 – 2008-12-08 16:03:29