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

NameDescription
System_CAPS_pubpropertyComments

Gets the comments associated with the file.

System_CAPS_pubpropertyCompanyName

Gets the name of the company that produced the file.

System_CAPS_pubpropertyFileBuildPart

Gets the build number of the file.

System_CAPS_pubpropertyFileDescription

Gets the description of the file.

System_CAPS_pubpropertyFileMajorPart

Gets the major part of the version number.

System_CAPS_pubpropertyFileMinorPart

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

System_CAPS_pubpropertyFileName

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

System_CAPS_pubpropertyFilePrivatePart

Gets the file private part number.

System_CAPS_pubpropertyFileVersion

Gets the file version number.

System_CAPS_pubpropertyInternalName

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

System_CAPS_pubpropertyIsDebug

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

System_CAPS_pubpropertyIsPatched

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.

System_CAPS_pubpropertyIsPreRelease

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

System_CAPS_pubpropertyIsPrivateBuild

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

System_CAPS_pubpropertyIsSpecialBuild

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

System_CAPS_pubpropertyLanguage

Gets the default language string for the version info block.

System_CAPS_pubpropertyLegalCopyright

Gets all copyright notices that apply to the specified file.

System_CAPS_pubpropertyLegalTrademarks

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

System_CAPS_pubpropertyOriginalFilename

Gets the name the file was created with.

System_CAPS_pubpropertyPrivateBuild

Gets information about a private version of the file.

System_CAPS_pubpropertyProductBuildPart

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

System_CAPS_pubpropertyProductMajorPart

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

System_CAPS_pubpropertyProductMinorPart

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

System_CAPS_pubpropertyProductName

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

System_CAPS_pubpropertyProductPrivatePart

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

System_CAPS_pubpropertyProductVersion

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

System_CAPS_pubpropertySpecialBuild

Gets the special build information for the file.

posted @ 2018-06-27 08:31  致林  阅读(3424)  评论(0编辑  收藏  举报