O'Reilly logo

Microsoft® Visual Basic® .NET Programmer's Cookbook by Matthew MacDonald

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Retrieve File Version Information

Problem

You want to retrieve file version information (such as the publisher of a file, its revision number, associated comments, and so on).

Solution

Use the GetVersionInfo method of the System.Diagnostics.FileVersionInfo class.

Discussion

In previous versions of Visual Basic, you needed to call Windows API functions to retrieve file version information. With the .NET Framework, you simply need to use the FileVersionInfo class and call the GetVersionInfo method with the filename as a parameter. You can then retrieve extensive information through the FileVersionInfo properties.

The FileVersionInfo properties are too numerous to list here, but the following code snippet shows an example of what you might retrieve:

Public ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required