Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to check the version of a file?

Tags:

c#

version

Is there a way to check the version of a file? I am using windows form application.

like image 949
2 revs, 2 users 98% Avatar asked Mar 15 '23 14:03

2 revs, 2 users 98%


2 Answers

You can use System.Diagnostics.FileVersionInfo.GetVersionInfo(String)

FileVersionInfo

Provides version information for a physical file on disk.

GetVersionInfo()

Returns a FileVersionInfo representing the version information associated with the specified file.

var version = FileVersionInfo.GetVersionInfo(path).FileVersion;
like image 97
Eric J. Avatar answered Mar 29 '23 06:03

Eric J.


Use this:

    var filePath = @"C:\Windows\System32\xwizard.exe";
    var fileInfo = FileVersionInfo.GetVersionInfo(filePath);
    var vers = fileInfo.FileVersion;
like image 42
Gregg Avatar answered Mar 29 '23 05:03

Gregg