Conditional attribute question

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
 
?

=?iso-8859-1?q?Nils Hedstr=f6m

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
 
N

Nicole Schenk

=?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
 
N

Nicole Schenk

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
 
N

Nicole Schenk

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,046
Latest member
Gavizuho

Latest Threads

Top