This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Download Microsoft Edge
More info about Internet Explorer and Microsoft Edge
public:
property System::String ^ FileVersion { System::String ^ get(); };
public string? FileVersion { get; }
public string FileVersion { get; }
member this.FileVersion : string
Public ReadOnly Property FileVersion As String
Property Value
Examples
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.
#using <System.dll>
using namespace System;
using namespace System::IO;
using namespace System::Diagnostics;
public ref class Class1
public:
static void Main()
// Get the file version for the notepad.
// Use either of the two following methods.
FileVersionInfo::GetVersionInfo(Path::Combine(Environment::SystemDirectory, "Notepad.exe"));
FileVersionInfo^ myFileVersionInfo = FileVersionInfo::GetVersionInfo(Environment::SystemDirectory + "\\Notepad.exe");
// Print the file name and version number.
Console::WriteLine("File: " + myFileVersionInfo->FileDescription + "\n" +
"Version number: " + myFileVersionInfo->FileVersion);
int main()
Class1::Main();
using System;
using System.IO;
using System.Diagnostics;
class Class1
public static void Main(string[] args)
// Get the file version for the notepad.
// Use either of the two following commands.
FileVersionInfo.GetVersionInfo(Path.Combine(Environment.SystemDirectory, "Notepad.exe"));
FileVersionInfo myFileVersionInfo = FileVersionInfo.GetVersionInfo(Environment.SystemDirectory + "\\Notepad.exe");
// Print the file name and version number.
Console.WriteLine("File: " + myFileVersionInfo.FileDescription + '\n' +
"Version number: " + myFileVersionInfo.FileVersion);
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
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:
The first 16 bits are the
FileMajorPart
number.
The next 16 bits are the
FileMinorPart
number.
The third set of 16 bits are the
FileBuildPart
number.
The last 16 bits are the
FilePrivatePart
number.