How to find file versions using C#

  • Thread starter Thread starter Kondapanaidu
  • Start date Start date
K

Kondapanaidu

Hi,

How to find the File Versions using C#.

I am using .NET1.1, WIN2K Professional.

Thanks in advance...

regards
 
Hello,

The properties of the File Object should allow you to do this (System.IO).
Unfortunalty i am not in front of my own computer at hte moment so i cant
give an example.

Regards
Scott Blood
C# Developer
 
Hi,

Use the FileVersionInfo class. It is located in the System.Diagnostics
namespace. It's static method GetVersionInfo can be used to elicit this
information.

eg. of use :
------------------------------------
public void GetFileVersion() {
// Get the file version for the notepad.
FileVersionInfo myFileVersionInfo =
FileVersionInfo.GetVersionInfo("C:\\WINNT\\Notepad.exe");

// Print the file name and version number.
Console.Writeline("File: " + myFileVersionInfo.FileDescription +
'\n' +
"Version number: " + myFileVersionInfo.FileVersion);
}
 
This feature is not implemented in the framework (at least in 1.1) , you
will have to P/invoke

System.Diagnostics.FileVersionInfo has been there since v1.0 IIRC.


Mattias
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top