Recently I had a need to find out if the build was in Debug mode. Our build process produced debug code in production, causing all kinds of issues so I went out into the web to find a way of determining if an assembly (or executable) was created in debug. It was much harder than I initially thought to get this information.
The article posted at The Black Box of .NET had the answer I was looking for.