C#获取文件版本信息

时间:2023-03-09 18:32:44
C#获取文件版本信息

使用FileVersionInfo获取版本信息

FileVersionInfo info = FileVersionInfo.GetVersionInfo(Application.Current.StartupUri + "ICC2.0.exe");
string productName = info.ProductName;
string productVersion = info.ProductVersion;
string companyName = info.CompanyName;
string legalCopyright = info.LegalCopyright;

FileVersionInfo相关属性

https://msdn.microsoft.com/en-us/library/system.diagnostics.fileversioninfo(v=vs.110).aspx

Name Description
C#获取文件版本信息 Comments

Gets the comments associated with the file.

C#获取文件版本信息 CompanyName

Gets the name of the company that produced the file.

C#获取文件版本信息 FileBuildPart

Gets the build number of the file.

C#获取文件版本信息 FileDescription

Gets the description of the file.

C#获取文件版本信息 FileMajorPart

Gets the major part of the version number.

C#获取文件版本信息 FileMinorPart

Gets the minor part of the version number of the file.

C#获取文件版本信息 FileName

Gets the name of the file that this instance of FileVersionInfo describes.

C#获取文件版本信息 FilePrivatePart

Gets the file private part number.

C#获取文件版本信息 FileVersion

Gets the file version number.

C#获取文件版本信息 InternalName

Gets the internal name of the file, if one exists.

C#获取文件版本信息 IsDebug

Gets a value that specifies whether the file contains debugging information or is compiled with debugging features enabled.

C#获取文件版本信息 IsPatched

Gets a value that specifies whether the file has been modified and is not identical to the original shipping file of the same version number.

C#获取文件版本信息 IsPreRelease

Gets a value that specifies whether the file is a development version, rather than a commercially released product.

C#获取文件版本信息 IsPrivateBuild

Gets a value that specifies whether the file was built using standard release procedures.

C#获取文件版本信息 IsSpecialBuild

Gets a value that specifies whether the file is a special build.

C#获取文件版本信息 Language

Gets the default language string for the version info block.

C#获取文件版本信息 LegalCopyright

Gets all copyright notices that apply to the specified file.

C#获取文件版本信息 LegalTrademarks

Gets the trademarks and registered trademarks that apply to the file.

C#获取文件版本信息 OriginalFilename

Gets the name the file was created with.

C#获取文件版本信息 PrivateBuild

Gets information about a private version of the file.

C#获取文件版本信息 ProductBuildPart

Gets the build number of the product this file is associated with.

C#获取文件版本信息 ProductMajorPart

Gets the major part of the version number for the product this file is associated with.

C#获取文件版本信息 ProductMinorPart

Gets the minor part of the version number for the product the file is associated with.

C#获取文件版本信息 ProductName

Gets the name of the product this file is distributed with.

C#获取文件版本信息 ProductPrivatePart

Gets the private part number of the product this file is associated with.

C#获取文件版本信息 ProductVersion

Gets the version of the product this file is distributed with.

C#获取文件版本信息 SpecialBuild

Gets the special build information for the file.