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?
+22
A:
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;
}
Stolen from here.
Andrew Flanagan
2008-12-08 16:00:20
That's excellent - I was hoping there was a .NET-ish way to do this.
Jon Tackabury
2008-12-08 16:03:29