Wednesday, April 30, 2008

How to find if a c# DLL was built in Debug or Release mode.

**Here is the text from that site as is**

Was an Assembly Built in Debug or Release Mode?

Sometimes you find yourself wondering if an assembly was compiled with or without the /debug compiler option, in the case of the C# compiler. The following download link will allow you to download a small C# program that given the path to an assembly will print either debug more or release mode to the console.

http://msmvps.com/files/102443/download.aspx

Basically this is determined by looking at the IsJITTrackingEnabled property of the DebuggableAttribute class as applied to the assembly in question. This property returns true if the runtime will track information during code generation for the debugger; otherwise, false.

Thanks to Bill for providing a blog posting in VB that this C# solution is based upon.

Notes: Within the Visual Studio 2005 solution that can be downloaded from this blog posting you will find three C# projects. The first of these projects, DebugBuild, contains the actual program that establishes if an assembly was built with the debug or release modes. Also within the solution are two other projects, Debug and Release, that are intended to allow you to test the DebugBuild program. These projects are simply new C# projects with only the Debug or Release configuration set, nothing more interesting than that there. If you have any questions regarding this code please contact me through the blog.

Published Tuesday, June 20, 2006 2:21 PM by DougHolland

No comments: