阅读从C#非.NET的DLL版本? [英] Read a non .NET DLL version from C#?
本文介绍了阅读从C#非.NET的DLL版本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有它的一些DLL文件(而不是.NET程序集)一个文件夹,我想阅读其中的文件信息。搞什么版本,名称...等什么是接近最好的方法?
I have a folder with some DLLs in it (not .NET assemblies) and I would like to read the file information in them. Things like the version, name... etc. What is the best way to approach this?
推荐答案
使用的FileVersionInfo对象。下面是从Microsoft网站,得到来自NOTEPAD.EXE
Use the FileVersionInfo object. Here's an example from the Microsoft website that gets the version info from 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#非.NET的DLL版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文