Conditional attribute question

  • Thread starter Thread starter Nicole Schenk
  • Start date Start date
N

Nicole Schenk

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
 
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
 
=?iso-8859-1?q?Nils Hedstr=f6m said:
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
 
Rulin said:
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
 
Rulin said:
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
 
Back
Top