有没有办法检查文件的版本?

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

有没有办法检查文件的版本?我正在使用 windows 表格申请。

您可以使用 System.Diagnostics.FileVersionInfo.GetVersionInfo(String)

文件版本信息

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;

使用这个:

    var filePath = @"C:\Windows\System32\xwizard.exe";
    var fileInfo = FileVersionInfo.GetVersionInfo(filePath);
    var vers = fileInfo.FileVersion;