Get Win32 file version?
-
Is there an interop or P/Invoke (or are those the same?) call to ascertain the Win32 file version of a file? I want to list the version of all files in a directory, but some may not be .NET assemblies. How can I read this info? Thanks.
Use FileVersionInfo.FileVersion. Try:
FileVersionInfo fv = FileVersionInfo.GetVersionInfo("Filename"); Console.WriteLine(fv.FileVersion);
Deja View - the feeling that you've seen this post before.
-
Is there an interop or P/Invoke (or are those the same?) call to ascertain the Win32 file version of a file? I want to list the version of all files in a directory, but some may not be .NET assemblies. How can I read this info? Thanks.
Hi, have a look at FileVersionInfo.GetVersionInfo(), it works for all kinds of files. :)
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips: - make Visual display line numbers: Tools/Options/TextEditor/... - show exceptions with ToString() to see all information - before you ask a question here, search CodeProject, then Google
-
Use FileVersionInfo.FileVersion. Try:
FileVersionInfo fv = FileVersionInfo.GetVersionInfo("Filename"); Console.WriteLine(fv.FileVersion);
Deja View - the feeling that you've seen this post before.
-
Is there an interop or P/Invoke (or are those the same?) call to ascertain the Win32 file version of a file? I want to list the version of all files in a directory, but some may not be .NET assemblies. How can I read this info? Thanks.
As has already been said, using
FileVersionInfo.GetVersionInfo()
is the right way to go. If you are only looking for the version number data, there aren't any problems. However, if you want to start looking at any of the other properties, a lot of the .NET assemblies will report incorrect data, particularly the IsDebug property.----------------------------- In just two days, tomorrow will be yesterday. http://geekswithblogs.net/sdorman