System.Diagnostics.FileVersionInfo Class

Provides version information for a physical file on disk.

See Also: FileVersionInfo Members

Syntax

public sealed class FileVersionInfo

Remarks

Typically, a version number is displayed as "major number.minor number.build number.private part number". A file version number is a 64-bit number that holds the version number for a file as follows:

Use the FileVersionInfo.GetVersionInfo(string) method of this class to get a System.Diagnostics.FileVersionInfo containing information about a file, then look at the properties for information about the file. The FileVersionInfo.FileVersion property provides version information about the file. The FileVersionInfo.ProductMajorPart, FileVersionInfo.ProductMinorPart, FileVersionInfo.ProductBuildPart, FileVersionInfo.ProductPrivatePart, and FileVersionInfo.ProductVersion properties provide version information for the product that the specified file is a part of. Call FileVersionInfo.ToString to get a partial list of properties and their values for this file.

The System.Diagnostics.FileVersionInfo properties are based on version resource information built into the file. Version resources are often built into binary files such as .exe or .dll files; text files do not have version resource information.

Version resources are typically specified in a Win32 resource file, or in assembly attributes. For example the FileVersionInfo.IsDebug property reflects the VS_FF_DEBUG flag value in the file's VS_FIXEDFILEINFO block, which is built from the VERSIONINFO resource in a Win32 resource file. For more information about specifying version resources in a Win32 resource file, see "About Resource Files" and "VERSIONINFO Resource" in the Platform SDK. For more information about specifying version resources in a .NET module, see the Setting Assembly Attributes topic.

Note:

This class makes a link demand at the class level that applies to all members. A System.Security.SecurityException is thrown when the immediate caller does not have full trust permission. For details about link demands, see Link Demands.

Requirements

Namespace: System.Diagnostics
Assembly: System (in System.dll)
Assembly Versions: 1.0.3300.0, 1.0.5000.0, 2.0.0.0, 4.0.0.0