Reputation: 697
Is there a way to check the version of a file? I am using windows form application.
Upvotes: 6
Views: 2755
Reputation: 150198
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;
Upvotes: 6
Reputation: 625
Use this:
var filePath = @"C:\Windows\System32\xwizard.exe";
var fileInfo = FileVersionInfo.GetVersionInfo(filePath);
var vers = fileInfo.FileVersion;
Upvotes: 3