C# 获取文件版本

var versionInfo = FileVersionInfo.GetVersionInfo(filePath);

String productVersion = versionInfo.ProductVersion;
String fileVersion = versionInfo.FileVersion;

其中

productionVersion/fileVersion为右键属性中的产品版本号及文件版本号。

在程序集属性中两者分别对应:

[assembly: AssemblyFileVersion("1.0.0.1")]
[assembly: AssemblyInformationalVersion("1.0.1.1")]

而程序集中常见的[assembly: AssemblyVersion("1.0.0.0")]属性则是程序集版本号,该号与要调用该程序集的程序集有关。

 

C# 获取文件版本

上一篇:Visual Studio2015如何连接到windows azure(国内版本)


下一篇:C# 手动添加响应函数