Is there any way to find out if an assembly has been compiled with the TRACE or DEBUG flag set without modifying the assembly?
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.
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.
static bool IsDebug(){
bool rv = false;
#if DEBUG
rv = true;
#endif
return rv;
}
How to Programmatically Detect if an Assembly is Compiled in Debug or Release mode from Scott Hanselman.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With