Determining Debug vs Release Mode at compile time

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

We have been trying to detirmine if a dll is compiled in Release or Debug
mode after it is compiled. I found serveral methods using reflection but
when test they all seemed to fail. Is there a way to detirmine if a compiled
assembly was compiled in Debug or release mode. We would like to add this to
our Automated build process.
 
WizyDig said:
We have been trying to detirmine if a dll is compiled in Release or Debug
mode after it is compiled. I found serveral methods using reflection but
when test they all seemed to fail. Is there a way to detirmine if a compiled
assembly was compiled in Debug or release mode. We would like to add this to
our Automated build process.

You could have a member (or even a whole type!) which is only declared
in debug mode:

#if DEBUG
public static boolean ThisWasCompiledInDebugMode;
#endif
 
We need to be able to determine this with out running the code. I'm familiar
with the #if DEBUG it only works at run time.
 
WizyDig said:
We need to be able to determine this with out running the code. I'm familiar
with the #if DEBUG it only works at run time.

Given that the member will be present or not, you can open the assembly
in something like reflector and check for its presence or absence. No
need to run any code in the assembly.
 
Hi wiz,

you could set the AssemblyConfiguration attribute dependend from the debug
mode.
This also can be read with reflection

Christof
 
Back
Top