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

Properties

Name Description
System_CAPS_pubproperty Comments

Gets the comments associated with the file.

System_CAPS_pubproperty CompanyName

Gets the name of the company that produced the file.

System_CAPS_pubproperty FileBuildPart

Gets the build number of the file.

System_CAPS_pubproperty FileDescription

Gets the description of the file.

System_CAPS_pubproperty FileMajorPart

Gets the major part of the version number.

System_CAPS_pubproperty FileMinorPart

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

System_CAPS_pubproperty FileName

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

System_CAPS_pubproperty FilePrivatePart

Gets the file private part number.

System_CAPS_pubproperty FileVersion

Gets the file version number.

System_CAPS_pubproperty InternalName

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

System_CAPS_pubproperty IsDebug

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

System_CAPS_pubproperty 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.

System_CAPS_pubproperty IsPreRelease

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

System_CAPS_pubproperty IsPrivateBuild

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

System_CAPS_pubproperty IsSpecialBuild

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

System_CAPS_pubproperty Language

Gets the default language string for the version info block.

System_CAPS_pubproperty LegalCopyright

Gets all copyright notices that apply to the specified file.

System_CAPS_pubproperty LegalTrademarks

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

System_CAPS_pubproperty OriginalFilename

Gets the name the file was created with.

System_CAPS_pubproperty PrivateBuild

Gets information about a private version of the file.

System_CAPS_pubproperty ProductBuildPart

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

System_CAPS_pubproperty ProductMajorPart

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

System_CAPS_pubproperty ProductMinorPart

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

System_CAPS_pubproperty ProductName

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

System_CAPS_pubproperty ProductPrivatePart

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

System_CAPS_pubproperty ProductVersion

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

System_CAPS_pubproperty SpecialBuild

Gets the special build information for the file.

你可能感兴趣的:(C#获取文件版本信息)