Export (0) Print
Expand All

FileVersionInfo.ProductVersion Property

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

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

public string ProductVersion { get; }
/** @property */
public String get_ProductVersion ()

public function get ProductVersion () : String

Not applicable.

Property Value

The version of the product this file is distributed with or a null reference (Nothing in Visual Basic) if the file did not contain version information.

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:

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.

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;
 }
    

private void GetProductVersion()
{
    // Get the file version for the notepad.
    FileVersionInfo myFileVersionInfo = 
        FileVersionInfo.GetVersionInfo("%systemroot%\\Notepad.exe");

    // Print the product version number.
    textBox1.set_Text("Product version number: " 
        + myFileVersionInfo.get_ProductVersion());
} //GetProductVersion

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;
 }
    

Windows 98, Windows Server 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 Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0

Community Additions

ADD
Show:
© 2014 Microsoft