NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

FileVersionInfo Class

Provides version information for a physical file on disk.

Object
   FileVersionInfo

[Visual Basic]
Public Class FileVersionInfo
[C#]
public class FileVersionInfo
[C++]
public __gc class FileVersionInfo
[JScript]
public 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 which holds the version number for a file as follows:

Use the static (in Visual Basic Shared) 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.

Requirements

Namespace: System.WinForms

Assembly: System.WinForms.dll

Example [Visual Basic]

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

[Visual Basic]

Private Sub GetFileVersion()
   'Get the file version for the Notepad.
   Dim myFileVersionInfo As System.Winforms.FileVersionInfo
   myFileVersionInfo = System.Winforms.FileVersionInfo.GetVersionInfo("c:\WINNT\Notepad.exe")

   'Print the file name and version number.
   TextBox1.Text = "File: " & myFileVersionInfo.FileDescription & crlf
   TextBox1.Text &= "Version Number: " & myFileVersionInfo.FileVersion
End Sub

See Also

FileVersionInfo Members | System.WinForms Namespace | FileVersion | System.WinForms.Version