在.NET的DLL版本号 [英] Version number of a dll in .NET

查看:197
本文介绍了在.NET的DLL版本号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

考虑以下内容:

string file = @"c:\somepath\somefile.dll";



我如何才能找到使用.NET该DLL的文件和产品版本号?

How can I find the file and product version numbers of that DLL using .NET?

该DLL可以是本机或托管。

The dll can be either native or managed.

感谢。

推荐答案

是,使用 System.Diagnostics.FileVersionInfo 。

string fileVersion = FileVersionInfo.GetVersionInfo(file).FileVersion;
string productVersion = FileVersionInfo.GetVersionInfo(file).ProductVersion;



被告知该程序集的文件版本可以从它的程序集的版本不同。该程序集版本是程序集标识的一部分。

Be advised that the file version of an assembly could be different from its assembly version. The assembly version is part of the assembly's identity.

这篇关于在.NET的DLL版本号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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