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.

2 Comments

Comments have been disabled for this content.