release build vs debug build

How do I determine if my app was compiled as “release” instead of “debug”? I went to VS 2008 Project Properties > Build and set the configuration from Debug to Release but I noticed no change? This is an ASP.NET project.


Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1


Method 2

If you want to know if the dll was built in Debug mode, with the debug attributes, then your best bet is reflection.

Taken from “How to tell if an existing assembly is debug or release“:

Assembly assembly = Assembly.GetAssembly(GetType());
bool debug = false;
foreach (var attribute in assembly.GetCustomAttributes(false)){
  if (attribute.GetType() ==  typeof(System.Diagnostics.DebuggableAttribute)){
    if (((System.Diagnostics.DebuggableAttribute)attribute)
      debug = true;

This will get the assembly that is calling that code (in effect itself), and then set the debug boolean to true if the assembly was compiled in debug mode, otherwise it’s false.

This could easily be dropped into a console app (as in the linked example), and then you pass in the path of the dll/exe you want to check. You would load the assembly from a path like this:

Assembly assembly = 

Method 3

For one in Web.config debug will be set to true, however you can actually set this in a release application too.

In debug however defines like DEBUG are set, so it’s simple to do:

bool is_debug;

#ifdef DEBUG
is_debug = true;
is_debug = false;

Method 4

You need to look for more than IsJITTrackingEnabled – which is completely independent of whether or not the code is compiled for optimization and JIT Optimization.

Also, the DebuggableAttribute is present if you compile in Release mode and choose DebugOutput to anything other than “none”.

Please refer to my posts:
How to Tell if an Assembly is Debug or Release and
How to identify if the DLL is Debug or Release build (in .NET)

All methods was sourced from or, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Notify of

Inline Feedbacks
View all comments
Would love your thoughts, please comment.x