如何获取DLL文件自身的版本信息

如何使用程序获取 AssemblyInfo.cs 文件中定义的版本相关信息

就是这些下面信息:
[assembly:   AssemblyTitle("")]
[assembly:   AssemblyDescription("")]
[assembly:   AssemblyConfiguration("")]
[assembly:   AssemblyCompany(")]
[assembly:   AssemblyProduct("")]
[assembly:   AssemblyCopyright("")]
[assembly:   AssemblyTrademark("")]
[assembly:   AssemblyCulture("")]
[assembly:   AssemblyVersion("1.0.*")]

方法一:

using   System.Reflection.Assembly
using   System.Diagnostics.FileVersionInfo
GetExecutingAssembly.GetName.Name
GetExecutingAssembly.Location
GetVersionInfo(GetExecutingAssembly.Location).ProductMajorPart
GetVersionInfo(GetExecutingAssembly.Location).ProductMinorPart
GetVersionInfo(GetExecutingAssembly.Location).ProductBuildPart
GetVersionInfo(GetExecutingAssembly.Location).LegalCopyright
GetVersionInfo(GetExecutingAssembly.Location).LegalTrademarks
GetVersionInfo(GetExecutingAssembly.Location).CompanyName

方法二:

System.Diagnostics.FileVersionInfo version = System.Diagnostics.FileVersionInfo.GetVersionInfo(Server.MapPath("bin/Seaskyer.dll"));

Response.Write(version.CompanyName);

 
分类: C#经典
posted on 2012-08-31 17:30  Asa.Zhu  阅读(3498)  评论(0编辑  收藏  举报