我怎样才能获得汇编文件版本 [英] How can I get the assembly file version

查看:253
本文介绍了我怎样才能获得汇编文件版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

程序集信息有两个组件的版本:

  1. 的AssemblyVersion :指定程序集的版本归咎于
  2. AssemblyFileVersion :指示编译器使用特定的版本号为Win32文件版本资源。在Win32文件版本不要求是相同的组件的版本号。
  1. AssemblyVersion: Specify the version of the assembly being attributed.
  2. AssemblyFileVersion: Instructs a compiler to use a specific version number for the Win32 file version resource. The Win32 file version is not required to be the same as the assembly's version number.

我可以获得组装版与code以下行:

I can get the Assembly Version with the following line of code:

Version version = Assembly.GetEntryAssembly().GetName().Version;

但我怎么能获得大会文件版本

推荐答案

请参阅我的上述评论要求澄清你真正想要的。但愿这是它:

See my comment above asking for clarification on what you really want. Hopefully this is it:

System.Reflection.Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly();
FileVersionInfo fvi = FileVersionInfo.GetVersionInfo(assembly.Location);
string version = fvi.FileVersion;

这篇关于我怎样才能获得汇编文件版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆