我有一个文件夹,里面有一些 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;
}
盗自 here .
关于c# - 从 C# 读取非 .NET DLL 版本?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/349943/