Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to find out if a .NET assembly was compiled with the TRACE or DEBUG flag

Is there any way to find out if an assembly has been compiled with the TRACE or DEBUG flag set without modifying the assembly?

like image 880
Ralf Avatar asked Mar 10 '09 11:03

Ralf


People also ask

How can I tell if a DLL is compiled in release mode?

One way that could work for most people is to simply open the DLL/EXE file with Notepad, and look for a path, for example search for "C:\" and you might find a path such as "C:\Source\myapp\obj\x64\Release\myapp. pdb", the "Release" shows that the build was done with Release configuration.

Where does .NET look for assemblies?

The runtime always begins probing in the application's base, which can be either a URL or the application's root directory on a computer. If the referenced assembly is not found in the application base and no culture information is provided, the runtime searches any subdirectories with the assembly name.


2 Answers

static bool IsDebug(){
 bool rv = false;
 #if DEBUG
 rv = true;
 #endif
 return rv;
}
like image 93
nothrow Avatar answered Sep 28 '22 06:09

nothrow


How to Programmatically Detect if an Assembly is Compiled in Debug or Release mode from Scott Hanselman.

like image 43
Nick Avatar answered Sep 28 '22 07:09

Nick