.NET中的dll的版本号 [英] Version number of a dll in .NET
本文介绍了.NET中的dll的版本号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
string file = @c:\somepath\somefile.dll;
如何使用.NET找到该DLL的文件和产品版本号?
该DLL可以是本地的或管理的。
谢谢。
解决方案
是的,使用 System.Diagnostics.FileVersionInfo 。
string fileVersion = FileVersionInfo.GetVersionInfo(file).FileVersion;
string productVersion = FileVersionInfo.GetVersionInfo(file).ProductVersion;
请注意,程序集的文件版本可能与程序集版本不同。装配版本是装配体的身份的一部分。
Given the following:
string file = @"c:\somepath\somefile.dll";
How can I find the file and product version numbers of that DLL using .NET?
The dll can be either native or managed.
Thanks.
解决方案
Yes, using 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屋!
查看全文