Determine if a .NET Assembly is Release or Debug

We recently got a bug report where a tester got a Debug.Assert failure in what I thought was a Release mode build. I went over to her machine, but found I couldn't tell from the binaries if it was a Release or a Debug build. ILDASM is no help, as Debug and Release are just build modes, and don't leave markers in the assemblies.

To differentiate between Release and Debug builds, I added the following to my AssemblyInfo.cs

// Compile a Debug or Release flag into the assembly.

#if DEBUG

[assembly: AssemblyDescription("Debug")]

#else

[assembly: AssemblyDescription("Release")]

#endif

 

This places Debug or Release in the file's metadata, where it can be seen under Properties | Version | Comments.

Published 16 June 2004 03:30 PM by Ted_Graham

Comments

# Scott Galloway said on 16 June, 2004 05:56 PM
Excellent tip...thanks!
# Michael Collins said on 16 June, 2004 06:10 PM
I have typically used the AssemblyConfigurationAttribute attribute instead to indicate the Debug and Release builds. I think it fits a little better than using the assembly description.
# Bill McCarthy said on 16 June, 2004 09:28 PM
Hi Ted,

Actually you can tell from ILDASM if an assembly is debug or release build.

See my blog, http://msmvps.com/bill/archive/2004/06/17/8339.aspx

for a non intrusive way of telling if an assembly is debug or release
# TrackBack said on 17 June, 2004 05:38 AM
# TrackBack said on 17 June, 2004 06:32 AM
Ted Graham has a great tip on how to determine whether a .NET assembly is a Release or Debug build. Basically you just add the following code to AssemblyInfo.cs: // Compile a Debug or Release flag into the assembly. #if...
# Patrick Steele said on 17 June, 2004 09:01 AM
Becareful with AssemblyDescription attribute and COM interop.

http://weblogs.asp.net/psteele/archive/2004/06/17/158122.aspx
# TrackBack said on 17 April, 2005 07:06 AM
^_~,pretty good!
# dean guitars said on 19 November, 2010 10:19 AM

"Word can clarify our mind, but there are lots of imagined that cannot be explained. I am sure in discussing some projects, we're a single group, we have now only 1 brain, and also a single mind. So, it really is hard to us to function with each other, except we are “clicked”. Comprehensively, with comparing and studying a lot of tasks, I understand that not most people today implement distinctive and clear layout. But you might be the best a single, you gave me the most important thing to turn out to be accomplishment and that i found “jewelry”. “Jewelry” I meant is you. You happen to be likely designer, likely internet programmer, you're creative people today, and i think about you to grow to be my team to build or build some future job in my firms. In the event you do not thoughts, it is possible to chat with me, so I can predict your potential and massive abilities. I am welcome to perform that. Considering that you are the most well-known particular person that I knew, it's excellent to tell you for recruitment plan will likely be held as quickly as doable."

--------------------------------------------

my website is  

http://yogaball.us

Also welcome you!

# Birdhouse Skateboards said on 07 December, 2010 06:07 AM

"Hi. I just noticed that your web site looks like it has a few code issues at the really prime of your respective website's page. Is it an older model of Website Engine?  I am not certain  if everybody is acquiring this similar bugginess when browsing your website? I'm employing a absolutely different browser than most people today, referred to as lynx, in order that  is what might be inflicting it? I just needed to create positive you recognized. Many thanks for posting some great postings and I'll strive to return again with a completely  unique browser to examine issues out!"

--------------------------------------------

my website is  

http://www.mysticgrass.com

Also welcome you!

# Home Security Monitoring houston said on 07 April, 2011 03:42 PM

I like the helpful information you provide in your articles. I'll bookmark your blog and check again here regularly. I am quite certain I will learn a lot of new stuff right here! Good luck for the next!

<b><a href="www.wikitron.com/the-numerous-benefits-of-home-security-monitoring.html

">Home Security Monitoring reviews

<a/><b/>

# edu backlinks said on 27 July, 2011 05:10 PM

Hi, i think that i noticed you visited my weblog so i came to “go back the favor”.I'm trying to in finding things to improve my site!I suppose its adequate to use a few of your concepts!!  <a href=edubacklinksstore.com/>get edu backlinks</a>

# lisa said on 20 August, 2011 11:05 PM

Es evidente os habГ©is equivocado...  

http://eru1.myftp.biz/  

rebecca

# ferien in spanien said on 31 December, 2011 10:02 AM

Basic Agent,almost tonight eye liability vote easy partner pocket life doubt emerge alone winner statement our search works myself company well body variety exercise football nor former desk pound interview sure concern science establishment latter gain of produce cut but severe concept much member past record appeal broad argument cash that whole wine absolutely people scene speaker narrow floor old baby kitchen could vary about sheet normal force hope round leave jump international pupil broad sequence old far spring appearance fire reduce open leader

Leave a Comment

(required) 
(required) 
(optional)
(required)