从C#读取非.NET DLL版本?
我有一个包含一些DLL的文件夹(不是.NET程序集),我想读取它们中的文件信息。 像版本,名称……等等。最好的方法是什么?
使用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; }
从这里偷来了 。