Description

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

Summary

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