Release Mode Configuration

Nov 19, 2010 at 10:45 PM

Curious, is BlogEngine set to Release mode when it's released for each version? The reason I ask is for the reasons outlined on a few sites:
http://www.dotnetnoob.com/2010/11/lesson-learned-http-modules-can-also.html
http://weblogs.asp.net/scottgu/archive/2006/04/11/Don_1920_t-run-production-ASP.NET-Applications-with-debug_3D001D20_true_1D20_-enabled.aspx
http://blogs.msdn.com/b/tess/archive/2006/04/13/575364.aspx

My main concern is with caching. In debug mode, ASP doesn't tell scripts and other axd handlers to cache their output.

I understand the reason to keep the main trunk in debug mode for people wanting to experiment with the code, but it might be helpful if, say, in the admin panel there were an alert saying "Currently running in Debug mode." and list off some reasons for wanting to make sure that your site's compiled in release mode when live.

Coordinator
Nov 20, 2010 at 1:42 AM

I'm almost certain that when we put out the releases, they are released in Release Mode.  At least I remember us doing that for BE 1.6.  I'm not sure about 1.6.1.  We'll need to be sure to set it for Release mode when releasing 2.0.

I know you can use:
HttpContext.Current.IsDebuggingEnabled

... to check if <compilation> mode is set for Debug or Release (it'll be true if in Debug mode).  The files in the website (outside the core) are unaffected by compiling in Debug or Release mode (these files aren't compiled).  I'm not sure offhand a way to programmatically determine if the BlogEngine.Core.dll was compiled in Release or Debug mode.  Probably using Reflection would be necessary, if at all possible.

Nov 20, 2010 at 1:59 AM

Oh, that'd be as simple as putting a property into the Utils class or somewhere else:

 

 public static bool IsDebugMode
 {
     get
          {
#if DEBUG
             return true;
#else
             return false;
#endif
          }
 }

 

I'm mostly concerned about the website project itself. The caching issue's definitely important.

Coordinator
Nov 20, 2010 at 2:08 AM

Good point there with the DEBUG code.

The 1.6.1 release on the releases page has debug="false" in the web.config file:

<compilation debug="false">