[C#] C#判断一个.net可执行文件时release版本还是debug版本 →→→→→进入此内容的聊天室

来自 , 2019-03-09, 写在 C#, 查看 139 次.
URL http://www.code666.cn/view/44012e79
  1. Assembly assembly = Assembly.GetAssembly(GetType());
  2. bool debug = false;
  3. foreach (var attribute in assembly.GetCustomAttributes(false)){
  4.   if (attribute.GetType() ==  typeof(System.Diagnostics.DebuggableAttribute)){
  5.     if (((System.Diagnostics.DebuggableAttribute)attribute)
  6.         .IsJITTrackingEnabled){
  7.       debug = true;
  8.       break;
  9.     }
  10.   }
  11. }
  12.  
  13.  
  14. //csharp/5912

回复 "C#判断一个.net可执行文件时release版本还是debug版本"

这儿你可以回复上面这条便签

captcha