FileVersionInfo Class

 

Provides version information for a physical file on disk.

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

System.Object
  System.Diagnostics.FileVersionInfo

<PermissionSetAttribute(SecurityAction.LinkDemand, Name := "FullTrust")>
Public NotInheritable Class FileVersionInfo

NameDescription
System_CAPS_pubpropertyComments

Gets the comments associated with the file.

System_CAPS_pubpropertyCompanyName

Gets the name of the company that produced the file.

System_CAPS_pubpropertyFileBuildPart

Gets the build number of the file.

System_CAPS_pubpropertyFileDescription

Gets the description of the file.

System_CAPS_pubpropertyFileMajorPart

Gets the major part of the version number.

System_CAPS_pubpropertyFileMinorPart

Gets the minor part of the version number of the file.

System_CAPS_pubpropertyFileName

Gets the name of the file that this instance of FileVersionInfo describes.

System_CAPS_pubpropertyFilePrivatePart

Gets the file private part number.

System_CAPS_pubpropertyFileVersion

Gets the file version number.

System_CAPS_pubpropertyInternalName

Gets the internal name of the file, if one exists.

System_CAPS_pubpropertyIsDebug

Gets a value that specifies whether the file contains debugging information or is compiled with debugging features enabled.

System_CAPS_pubpropertyIsPatched

Gets a value that specifies whether the file has been modified and is not identical to the original shipping file of the same version number.

System_CAPS_pubpropertyIsPreRelease

Gets a value that specifies whether the file is a development version, rather than a commercially released product.

System_CAPS_pubpropertyIsPrivateBuild

Gets a value that specifies whether the file was built using standard release procedures.

System_CAPS_pubpropertyIsSpecialBuild

Gets a value that specifies whether the file is a special build.

System_CAPS_pubpropertyLanguage

Gets the default language string for the version info block.

System_CAPS_pubpropertyLegalCopyright

Gets all copyright notices that apply to the specified file.

System_CAPS_pubpropertyLegalTrademarks

Gets the trademarks and registered trademarks that apply to the file.

System_CAPS_pubpropertyOriginalFilename

Gets the name the file was created with.

System_CAPS_pubpropertyPrivateBuild

Gets information about a private version of the file.

System_CAPS_pubpropertyProductBuildPart

Gets the build number of the product this file is associated with.

System_CAPS_pubpropertyProductMajorPart

Gets the major part of the version number for the product this file is associated with.

System_CAPS_pubpropertyProductMinorPart

Gets the minor part of the version number for the product the file is associated with.

System_CAPS_pubpropertyProductName

Gets the name of the product this file is distributed with.

System_CAPS_pubpropertyProductPrivatePart

Gets the private part number of the product this file is associated with.

System_CAPS_pubpropertyProductVersion

Gets the version of the product this file is distributed with.

System_CAPS_pubpropertySpecialBuild

Gets the special build information for the file.

NameDescription
System_CAPS_pubmethodEquals(Object)

Determines whether the specified object is equal to the current object.(Inherited from Object.)

System_CAPS_pubmethodGetHashCode()

Serves as the default hash function. (Inherited from Object.)

System_CAPS_pubmethodGetType()

Gets the Type of the current instance.(Inherited from Object.)

System_CAPS_pubmethodSystem_CAPS_staticGetVersionInfo(String)

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

System_CAPS_pubmethodToString()

Returns a partial list of properties in the FileVersionInfo and their values.(Overrides Object.ToString().)

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 GetVersionInfo method of this class to get a FileVersionInfo containing information about a file, then look at the properties for information about the file. The FileVersion property provides version information about the file. The ProductMajorPart, ProductMinorPart, ProductBuildPart, ProductPrivatePart, and ProductVersion properties provide version information for the product that the specified file is a part of. Call ToString to get a partial list of properties and their values for this file.

The 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 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.

System_CAPS_noteNote

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

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.

Imports System
Imports System.IO
Imports System.Diagnostics



Class Class1

    Public Shared Sub Main(ByVal args() As String)
        ' Get the file version for the notepad.
        ' Use either of the following two commands.
        FileVersionInfo.GetVersionInfo(Path.Combine(Environment.SystemDirectory, "Notepad.exe"))
        Dim myFileVersionInfo As FileVersionInfo = FileVersionInfo.GetVersionInfo(Environment.SystemDirectory + "\Notepad.exe")


        ' Print the file name and version number.
        Console.WriteLine("File: " + myFileVersionInfo.FileDescription + vbLf + "Version number: " + myFileVersionInfo.FileVersion)

    End Sub
End Class

SecurityAction.LinkDemand

for full trust for the immediate caller. This class cannot be used by partially trusted code.

.NET Framework
Available since 1.1

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top
Show: