ZombieSheep's answer is incorrect.
My answer to this duplicate question is here:How to tell if a .NET application was compiled in DEBUG or RELEASE mode?
Be very careful - just looking at the 'assembly attributes' in the Assembly Manifest for the presence of the 'Debuggable' attribute does NOT mean that you have an assembly that is not JIT optimized. The assembly could be JIT optimized but have the Assembly Output under Advanced Build settings set to include 'full' or 'pdb-only' info - in which case the 'Debuggable' attribute will be present.
Please refer to my posts below for more info:
How to Tell if an Assembly is Debug or Release and
How to identify if the DLL is Debug or Release build (in .NET)
Jeff Key's application doesn't work correctly, because it identifies a "Debug" build based on if the DebuggableAttribute is present. The DebuggableAttribute is present if you compile in Release mode and choose DebugOutput to anything other than "none".
You also need to define exaclty what is meant by "Debug" vs. "Release"...
- Do you mean that the application is configured with code optimization?
- Do you mean that you can attach the Visual Studio/JIT Debugger to it?
- Do you mean that it generates DebugOutput?
- Do you mean that it defines the DEBUG constant? Remember that you can conditionally compile methods with the
System.Diagnostics.Conditional()
attribute.