Decrease Font Size
Increase Font Size
   BLOG

ASP.NET windows application - detecting debug mode

by Admin 27. June 2009 21:40

Today, I was working on one of the windows application and at one point I need to figure out if the application is running on the Debug mode or Release mode.

We can use HttpContext.Current.IsDebuggingEnabled for the web applications.

As for the Windows Application, Initially I was using the code below

 internal static bool DebugMode()
        {
            bool isDebugMode = false;
//Application.StartupPath will give me the path for the executable file that started the application
            if (Application.StartupPath.Contains(@"\bin\Release")) //it will be \bin\Debug if we running on Debug Mode
                isDebugMode = false;

            return isDebugMode;
        }

But then I found this piece of code, which I think is cool because I never thought about this approach

from http://www.west-wind.com/WebLog/posts/10228.aspx

 internal static bool IsDebug
        {
            #if DEBUG
                get{ return true;}
            #else
                get { return false; }
            #endif
        }

Tags: , ,

ASP.NET

Comments

6/20/2009 4:13:32 AM #

wisata ciamis

The template of this blog is quite good, and I think the score of this blog is 8.7 and I will vote for you in Blogs Choice Awards

wisata ciamis United Kingdom

6/20/2009 8:38:11 PM #

admin

Thanks Smile

admin United States

10/26/2009 10:11:13 PM #

regcure review

Helpful tip, thank you

regcure review United States

11/12/2009 5:13:26 AM #

traslochi milano

Thanks for sharing this powerful information.That's very helpful and interesting.

traslochi milano United States

12/1/2009 9:27:48 PM #

Melayu Boleh

Excellent read. Very insightful. I'm kind of new to the world of blogging, this will definately help.

Melayu Boleh Australia

2/12/2010 3:14:39 PM #

application hosting

I’m impressed, you know what you’re talking about

application hosting United States

3/10/2010 10:07:11 PM #

meilleures pages de casino en ligne


I will recommend my friends to read this.I will bookmark your blog and have my children check up here often.I am quite sure they will learn lots of new stuff here than anybody else!....

meilleures pages de casino en ligne India

3/26/2010 4:35:56 AM #

Steve

This is my first time i visit here. I found so many interesting stuff in your blog especially its discussion. From the tons of comments on your articles, I guess I am not the only one having all the enjoyment here! keep up the good work.

Steve Croatia

Add comment


(Will show your Gravatar icon)

  Country flag

Click to change captcha
biuquote
  • Comment
  • Preview
Loading