This documentation is archived and is not being maintained.

FileVersionInfo.GetVersionInfo Method

Returns a FileVersionInfo representing the version information associated with the specified file.

Namespace: System.Diagnostics
Assembly: System (in system.dll)

public static FileVersionInfo GetVersionInfo (
	string fileName
public static FileVersionInfo GetVersionInfo (
	String fileName
public static function GetVersionInfo (
	fileName : String
) : FileVersionInfo



The fully qualified path and name of the file to retrieve the version information for.

Return Value

A FileVersionInfo containing information about the file. If the file did not contain version information, the FileVersionInfo contains only the name of the file requested.

Exception typeCondition


The file specified cannot be found.

The following example calls GetVersionInfo to get the FileVersionInfo for the Notepad. Then it prints the file description and version number in a text box. This code assumes textBox1 has been instantiated.

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;

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0, 1.1, 1.0