Home All Groups Group Topic Archive Search About

tell if site is a debug build?

Author
1 Nov 2005 8:24 PM
Brian Henry
I am trying to tell if my site is running as a debug build or not in asp.net
1.1 you  could say

#IF DEBUG
DO SOMETHING HERE
#ENDIF

but in ASP.NET 2.0 it seems not to work anymore... why not?! i have
debug="false" in web config and the debug code still runs...

Author
1 Nov 2005 9:04 PM
Brad Roberts
On the Visual Studio menu under Build/Configuration change the active
configuration to "Release". The "debug" code will not be included in the
resulting executable.

Show quoteHide quote
"Brian Henry" wrote:

> I am trying to tell if my site is running as a debug build or not in asp.net
> 1.1 you  could say
>
> #IF DEBUG
>  DO SOMETHING HERE
> #ENDIF
>
> but in ASP.NET 2.0 it seems not to work anymore... why not?! i have
> debug="false" in web config and the debug code still runs...
>
>
>
Are all your drivers up to date? click for free checkup

Author
1 Nov 2005 9:51 PM
Brian Henry
thast what I always did in .NET 1.1 and 1.0 but in 2.0 that doesn't work any
more when you have #if debug directives in it for some reason... my #debug
code always runs release or debug build


Show quoteHide quote
"Brad Roberts" <BradRoberts56noj***@hotmail.com> wrote in message
news:4F8D119C-0D93-4AA1-907C-1F03DBD62413@microsoft.com...
> On the Visual Studio menu under Build/Configuration change the active
> configuration to "Release". The "debug" code will not be included in the
> resulting executable.
>
> "Brian Henry" wrote:
>
>> I am trying to tell if my site is running as a debug build or not in
>> asp.net
>> 1.1 you  could say
>>
>> #IF DEBUG
>>  DO SOMETHING HERE
>> #ENDIF
>>
>> but in ASP.NET 2.0 it seems not to work anymore... why not?! i have
>> debug="false" in web config and the debug code still runs...
>>
>>
>>
Author
2 Nov 2005 3:08 PM
Scott Allen
On Tue, 1 Nov 2005 16:51:26 -0500, "Brian Henry" <nospam@nospam.com>
wrote:

>thast what I always did in .NET 1.1 and 1.0 but in 2.0 that doesn't work any
>more when you have #if debug directives in it for some reason... my #debug
>code always runs release or debug build
>

Right - those options aren't available in 2.0.

Are you using a filed based web site or one in IIS? I can see my code
not executing inside #if DEBUG if I turn debugging off and run with
CTRL-F5. Perhaps you could clean out the Temporary ASP.NET files
directory and see what happens.

Author
15 Nov 2005 10:26 AM
ron
I'm having the same problem. Using the compiler directive #IF DEBUG
around my code, works when debugging, but when I set the

<compilation defaultLanguage="c#" debug="false">

in web.config for release build, the debug statements still run, ie the
DEBUG constant is still set to true.

Any thoughts or alternative solutions anyone?

Scott Allen wrote:
Show quoteHide quote
> On Tue, 1 Nov 2005 16:51:26 -0500, "Brian Henry" <nospam@nospam.com>
> wrote:
>
> >thast what I always did in .NET 1.1 and 1.0 but in 2.0 that doesn't work any
> >more when you have #if debug directives in it for some reason... my #debug
> >code always runs release or debug build
> >
>
> Right - those options aren't available in 2.0.
>
> Are you using a filed based web site or one in IIS? I can see my code
> not executing inside #if DEBUG if I turn debugging off and run with
> CTRL-F5. Perhaps you could clean out the Temporary ASP.NET files
> directory and see what happens.
>
> --
> Scott
> http://www.OdeToCode.com/blogs/scott/
Author
15 Nov 2005 12:30 PM
Patrice
Where do you have this #if test (in ASPX markup or in a code behing file) ?
My first thought would be that you disabled debug for ASPX pages but that
you still have in /bin a code behind DLL compiled in Debug mode...

Is this 1.1 or 2.0 ? Which compilation model are you using ?

---
Patrice


<r**@stringx.com> a écrit dans le message de
Show quoteHide quote
news:1132050417.061177.124660@g49g2000cwa.googlegroups.com...
> I'm having the same problem. Using the compiler directive #IF DEBUG
> around my code, works when debugging, but when I set the
>
> <compilation defaultLanguage="c#" debug="false">
>
> in web.config for release build, the debug statements still run, ie the
> DEBUG constant is still set to true.
>
> Any thoughts or alternative solutions anyone?
>
> Scott Allen wrote:
> > On Tue, 1 Nov 2005 16:51:26 -0500, "Brian Henry" <nospam@nospam.com>
> > wrote:
> >
> > >thast what I always did in .NET 1.1 and 1.0 but in 2.0 that doesn't
work any
> > >more when you have #if debug directives in it for some reason... my
#debug
> > >code always runs release or debug build
> > >
> >
> > Right - those options aren't available in 2.0.
> >
> > Are you using a filed based web site or one in IIS? I can see my code
> > not executing inside #if DEBUG if I turn debugging off and run with
> > CTRL-F5. Perhaps you could clean out the Temporary ASP.NET files
> > directory and see what happens.
> >
> > --
> > Scott
> > http://www.OdeToCode.com/blogs/scott/
>
Author
15 Nov 2005 2:42 PM
Scott Allen
Here is some more information:
  http://odetocode.com/Blogs/scott/archive/2005/11/15/2464.aspx

Show quoteHide quote
On Tue, 1 Nov 2005 15:24:01 -0500, "Brian Henry" <nospam@nospam.com>
wrote:

>I am trying to tell if my site is running as a debug build or not in asp.net
>1.1 you  could say
>
>#IF DEBUG
> DO SOMETHING HERE
>#ENDIF
>
>but in ASP.NET 2.0 it seems not to work anymore... why not?! i have
>debug="false" in web config and the debug code still runs...
>

Bookmark and Share