asp.net获取程序集信息(AssemblyInfo)
2012-08-29 17:53
375 查看
获取标题、说明、公司、产品、版权、商标、程序集版本、文件版本、Guid等信息。如图:
方法:
方法:
public partial class ReadAssemblyInfo: System.Web.UI.Page { public string AssemblyTitle { get { object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyTitleAttribute), false); if (attributes.Length > 0) { AssemblyTitleAttribute titleAttribute = (AssemblyTitleAttribute)attributes[0]; if (titleAttribute.Title != "") { return titleAttribute.Title; } } return System.IO.Path.GetFileNameWithoutExtension(Assembly.GetExecutingAssembly().CodeBase); } } public string AssemblyVersion { get { return Assembly.GetExecutingAssembly().GetName().Version.ToString(); } } public string AssemblyDescription { get { object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyDescriptionAttribute), false); if (attributes.Length == 0) { return ""; } return ((AssemblyDescriptionAttribute)attributes[0]).Description; } } public string AssemblyProduct { get { object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyProductAttribute), false); if (attributes.Length == 0) { return ""; } return ((AssemblyProductAttribute)attributes[0]).Product; } } public string AssemblyCopyright { get { object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false); if (attributes.Length == 0) { return ""; } return ((AssemblyCopyrightAttribute)attributes[0]).Copyright; } } public string AssemblyCompany { get { object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCompanyAttribute), false); if (attributes.Length == 0) { return ""; } return ((AssemblyCompanyAttribute)attributes[0]).Company; } } }
相关文章推荐
- SQL Server 2005 安装程序无法获取 ASP.NET 帐户的系统帐户信息
- SQL Server 2005 安装程序无法获取 ASP.NET 帐户的系统帐户信息.若要继续,请重新安装 .NET Framework,然后再次运行 SQL Server 安装程序。
- SQL Server 2005 安装程序无法获取 ASP.NET 帐户的系统帐户信息
- asp.net C#获取程序文件相关信息
- 安装sql server 2005时系统提示安装程序无法获取asp.net 的账户信息 如要继续安装先重新安装.net frame
- SQL Server 2005 安装程序无法获取 ASP.NET 帐户的系统帐户信息.若要继续,请重新安装 .NET Framework,然后再次运行 SQL Server 安装程序
- sql server安装程序无法获取ASP_NET 帐户的系统帐户信息...
- SQL Server 2005 安装程序无法获取 ASP.NET 帐户的系统帐户信息
- SQL Server 2005 安装程序无法获取 ASP.NET 帐户的系统帐户信息
- asp.net C#获取程序文件相关信息
- SQL Server 2005 安装程序无法获取 ASP_NET 帐户的系统帐户信息
- 【C#】获取程序中Properties下的AssemblyInfo.cs下的信息
- asp.net一般处理程序(2)获取列表
- Asp.net Request方法获取客户端的信息
- .NET跨平台:在Mac上跟着错误信息一步一步手写ASP.NET 5程序
- ASP.NET获取IP及电脑名等信息的简单方法+通用类文件源码 (转载)
- ASP.NET获取客户端的操作系统、浏览器、.NET版本等信息
- ASP.NET获取客户端的相关信息
- asp.net 关于 试图加载格式不正确的程序 <add assembly="*"/>错误
- (转)ASP.NET获取客户端及服务器的信息