Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

FileVersionInfo.ProductVersion Property

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

[Visual Basic]
Public ReadOnly Property ProductVersion As String
[C#]
public string ProductVersion {get;}
[C++]
public: __property String* get_ProductVersion();
[JScript]
public function get ProductVersion() : String;

Property Value

The version of the product this file is distributed with.

Remarks

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

Example

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

[Visual Basic] 
Private Sub GetProductVersion()
    ' Get the file version for the notepad.
    Dim myFileVersionInfo As FileVersionInfo = _
        FileVersionInfo.GetVersionInfo("%systemroot%\Notepad.exe")
    
    ' Print the product version number.
    textBox1.Text = "Product version number: " & myFileVersionInfo.ProductVersion
End Sub 'GetProductVersion

[C#] 
private void GetProductVersion() {
    // Get the file version for the notepad.
    FileVersionInfo myFileVersionInfo = FileVersionInfo.GetVersionInfo("%systemroot%\\Notepad.exe");
 
    // Print the product version number.
    textBox1.Text = "Product version number: " + myFileVersionInfo.ProductVersion;
 }
    

[C++] 
private:
void GetProductVersion() {
    // Get the file version for the notepad.
    FileVersionInfo* myFileVersionInfo = FileVersionInfo::GetVersionInfo(S"%systemroot%\\Notepad.exe");
 
    // Print the product version number.
    textBox1->Text = String::Format( S"Product version number: {0}", myFileVersionInfo->ProductVersion );
 }
    

[JScript] 
private function GetProductVersion() {
    //Get the file version for the notepad.
    var myFileVersionInfo : FileVersionInfo = FileVersionInfo.GetVersionInfo("%systemroot%\\Notepad.exe");
 
    //Print the product version number.
    textBox1.Text = "Product version number: " + myFileVersionInfo.ProductVersion;
 }
    

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also

FileVersionInfo Class | FileVersionInfo Members | System.Diagnostics Namespace | ProductBuildPart | ProductMinorPart | ProductMajorPart | ProductPrivatePart

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2015 Microsoft