c# - How to tell if calling assembly is in DEBUG mode from compiled referenced lib -
i have referenced library, inside there want perform different action if assembly references in debug/release mode.
is possible switch on condition calling assembly in debug/release mode?
is there way without resorting like:
bool debug = false; #if debug debug = true; #endif referencedlib.someclass.debug = debug;
the referencing assembly starting point of application (i.e. web application.
google says simple. information debuggableattribute of assembly in question:
isassemblydebugbuild(assembly.getcallingassembly()); private bool isassemblydebugbuild(assembly assembly) { foreach (var attribute in assembly.getcustomattributes(false)) { var debuggableattribute = attribute debuggableattribute; if(debuggableattribute != null) { return debuggableattribute.isjittrackingenabled; } } return false; }
Comments
Post a Comment