Conditional attribute question

Discussion in 'ASP .Net' started by Nicole Schenk, Jan 31, 2005.

  1. I am placing this code in an aspx or ascx,

    If I write (in C#),
    [Conditional("DEBUGGING")] SomeMethod(){}

    Where do I set "DEBUGGING".

    When I try a #define, the compiler complains if I place de define:
    1. If after the first line,
    2. If I put it as the first line, the line gets parsed as simple text to be
    rendered and I see it in the output of the aspx or ascx.

    Thanks
    Nicole Schenk, Jan 31, 2005
    #1
    1. Advertising

  2. Hello Nicole,

    Right-click on your project in the solution explorer in Visual Studio and
    choose properties.
    Select Configuration properties->Build.
    In there you can select if you want the Debug, Trace or custom constants
    should be defined for the current configuration (usually Debug or Release).
    By default the 'Debug'-constant is defined for the Debug-configuration.

    I hope this helps you
    /nisse

    > I am placing this code in an aspx or ascx,
    >
    > If I write (in C#),
    > [Conditional("DEBUGGING")] SomeMethod(){}
    > Where do I set "DEBUGGING".
    >
    > When I try a #define, the compiler complains if I place de define:
    > 1. If after the first line,
    > 2. If I put it as the first line, the line gets parsed as simple text
    > to be
    > rendered and I see it in the output of the aspx or ascx.
    > Thanks
    >
    =?iso-8859-1?q?Nils Hedstr=f6m, Jan 31, 2005
    #2
    1. Advertising

  3. =?iso-8859-1?q?Nils Hedstr=f6m wrote:

    > Hello Nicole,
    >
    > Right-click on your project in the solution explorer in Visual Studio and
    > choose properties.
    > Select Configuration properties->Build.
    > In there you can select if you want the Debug, Trace or custom constants
    > should be defined for the current configuration (usually Debug or
    > Release). By default the 'Debug'-constant is defined for the
    > Debug-configuration.
    >
    > I hope this helps you
    > /nisse
    >
    >> I am placing this code in an aspx or ascx,
    >>
    >> If I write (in C#),
    >> [Conditional("DEBUGGING")] SomeMethod(){}
    >> Where do I set "DEBUGGING".
    >>
    >> When I try a #define, the compiler complains if I place de define:
    >> 1. If after the first line,
    >> 2. If I put it as the first line, the line gets parsed as simple text
    >> to be
    >> rendered and I see it in the output of the aspx or ascx.
    >> Thanks
    >>

    I don't use the IDE for this project. How would I do it outside of the IDE?
    Would be the web.config file?

    Thanks
    Nicole Schenk, Jan 31, 2005
    #3
  4. It's about building(compiling).
    us csc /define:DEBUG for C#
    use vbc /debug for VB.NET
    =?Utf-8?B?UnVsaW4gSG9uZw==?=, Jan 31, 2005
    #4
  5. Rulin Hong wrote:

    > It's about building(compiling).
    > us csc /define:DEBUG for C#
    > use vbc /debug for VB.NET

    Thanks, I think I understand that. However, when I need it when I simple
    invoke the apsx without precompiling it. Just from the browser refer to an
    URL that references the aspx or ascx involved.

    Thanks
    Nicole Schenk, Jan 31, 2005
    #5
  6. Rulin Hong wrote:

    > It's about building(compiling).
    > us csc /define:DEBUG for C#
    > use vbc /debug for VB.NET

    Great, I figured it out with your help. You can put the attribute
    CompilerOptions in the Page directtive of the aspx.

    Thanks
    Nicole Schenk, Feb 2, 2005
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. itsme
    Replies:
    1
    Views:
    1,624
    Ralf Hildebrandt
    Jul 23, 2003
  2. 3W
    Replies:
    3
    Views:
    1,217
    Enrique
    Apr 17, 2004
  3. Alec S.
    Replies:
    10
    Views:
    10,144
    Alec S.
    Apr 16, 2005
  4. Bostonasian
    Replies:
    1
    Views:
    816
    Joris Gillis
    Sep 18, 2005
  5. Replies:
    2
    Views:
    1,076
    Henry S. Thompson
    Mar 6, 2006
Loading...

Share This Page