Version Information of a File on disk

By Mayur Dighe Sep 02, 2012
The Blog demonstrate, a way to obtain the Version Information or Properties of a Physical File (.exe or .dll etc.) on a disk.


About Classes used

 #1: An object of FileVersionInfo class Provides version information for a physical file on disk.
#2: The Information retrieved from object of FileVersionInfo class is READ-ONLY information.
We cannot alter or modify this information.

Namespace Required - System.Diagnostics

Here I implemented the Code for retrieving version information for a physical file on disk.

The Code

1. Put the following code into your program (do necessary changes).  

// txtPath is the Name of TextBox Control
// New instance of FileVersionInfo
FileVersionInfo info = FileVersionInfo.GetVersionInfo(txtPath.Text);
String Info     "File Name  : " + info.FileName +
                  "InternalName   : " + info.InternalName +
                  "ProductName    : " + info.ProductName +
                        "ProductVersion : " + info.ProductVersion +
                        "OriginalFilename : " + info.OriginalFilename +
                  "LegalTrademarks  : " + info.LegalTrademarks +
                        "LegalCopyright   : " + info.LegalCopyright +
                        "FileDescription  : " + info.FileDescription +
                        "CompanyName        : " + info.CompanyName +
                        "Comments         : " + info.Comments;

Listing 1

2. Now you can pass this string to any label or text control. (Here I used it for a Text Control)

3. Now execute the Application and see the result (Figure 1).

Intended Result:

New Picture (2).png

Figure 1


In this piece of writing, using C# environment, we have seen how to retrieve version information for a specified physical file from disk.

Mayur Dighe
Mayur Dighe

Mayur B. Dighe – is a Hobbyist Programmer and Engineering Student. He completed a Diploma in Computer Technology in 2011 and also currently pursuing IT Engineering from University of Pune, India.My Blog : &... Read more