判断dll是版本(Debug Or Release)[测试通过]

简介: 简单的代码,google搜索提炼和分析,主要是利用反射技术,测试通过,抛砖引玉,自娱自乐,多多指教。 public partial class _Default : System.Web.

简单的代码,google搜索提炼和分析,主要是利用反射技术,测试通过,抛砖引玉,自娱自乐,多多指教。

 
 
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load( object sender, EventArgs e)
{
if ( ! IsPostBack)
{
Assembly ass
= Assembly.LoadFile( @" D:\com.uuu9.api.dll " );
DebuggableAttribute att
= Utils.GetCustomAttribute < DebuggableAttribute > (ass);
Response.Write(att.IsJITTrackingEnabled
? " Debug " : " Release " );
}
}

}

public static class Utils
{
public static T GetCustomAttribute < T > ( this ICustomAttributeProvider provider)
where T : Attribute
{
var attributes
= provider.GetCustomAttributes( typeof (T), false );
return attributes.Length > 0 ? attributes[ 0 ] as T : default (T);
}
}
img_fa0be433d68c8212b2b0b3b1a564ccb1.png
如果本文对你有所帮助,请打赏——1元就足够感动我:)
支付宝打赏 微信打赏
联系邮箱:intdb@qq.com
我的GitHub: https://github.com/vipstone
关注公众号: img_9bde0f31ac4a0eca10b1bd7414b78faf.png


作者: 王磊
出处: http://vipstone.cnblogs.com/
本文版权归作者和博客园共有,欢迎转载,请标明出处。

相关文章
|
11月前
|
存储 Cloud Native Linux
QtCreator中三种不同编译版本 debug、release、profile 的区别
QtCreator中三种不同编译版本 debug、release、profile 的区别
|
3天前
|
算法 计算机视觉
Mat未初始化引起拼接算法结果,release版本和debug版本不一致
在OpenCV中由于Mat对象未初始化导致的拼接算法在release版本和debug版本中结果不一致的问题,并提供了通过显式初始化Mat对象为零来解决这一问题的修改方法。
|
5月前
|
算法 编译器 程序员
深入理解C++编译模式:了解Debug和Release的区别
深入理解C++编译模式:了解Debug和Release的区别
768 3
|
5月前
|
C++
[VS配置] 平台配置由Debug更换Release后出现错误
[VS配置] 平台配置由Debug更换Release后出现错误
46 0
调试实战 —— dll 加载失败之 Debug Release 争锋篇
调试实战 —— dll 加载失败之 Debug Release 争锋篇
|
iOS开发
Xcode如何编译Debug版和Release版​
Xcode如何编译Debug版和Release版​
|
芯片 内存技术
MDK 下载程序出现no target connected 导致下载失败
MDK 下载程序出现no target connected 导致下载失败
514 0
MDK 下载程序出现no target connected 导致下载失败
linux下debug与release编译的方法
linux下debug与release编译的方法
|
编译器 C++ Windows
VS2010编译生成lib库Release版本比Debug版本大的原因
最近在visual studio2010和2019生成Windows的lib库的时候发现Release版本的lib比Debug版本要大
198 0
VS2010编译生成lib库Release版本比Debug版本大的原因
|
Linux 计算机视觉
关于 编译qt项目时报错:error: cannot find -lGLESv2 的解决方法
关于 编译qt项目时报错:error: cannot find -lGLESv2 的解决方法