- Is it possible to define the DEBUG constant for web development project in Visual Studio 2005
I can see how it is done for a Windows Project, but not for a website project.
-
- Define DEBUG constant
-
Defines the DEBUG symbol. Selecting this is equivalent to using the /define:DEBUG command line option.
- Define TRACE constant
-
Defines the TRACE symbol. Selecting this is equivalent to using the /define:TRACE command line option.

Define DEBUG constant for a web project
pater
Thank you for your reply it was helpful.
When you say "something to yoru build process to handle these constants" are you talking an include file
The reason I am using the DEBUG constant is because on my development machine it does not support SMTP Client and I write the information to a log file. On the production web site I do not want to do this. Perhaps there is a better way to do this
Mike_A139353
Hi!
I would have some question about debugging in ASP.NET 2.0. I've just converted my ASP.NET project to the newer version (2.0). But i have some problems.
1., I would like to test my web project on my local machine. In the old version, when I set fe. "debug with dbc" configuration, then the code in the #DBC directive was active. Now all code is in my own custom directives are inactive. I try to set in web.config compilerOptions="/d
EBUG,DBC"/>, but it doesnt helps. I dont understand, that without these codes the build should be failed, because there are some relevant part in them, but it seems success.
2., I cannot find the compiled dll. In the old version it was in the bin subdirectory.
3., When I try to launch project in debug mode, i get a message in the IE, i have no permission to watch this page.
Can anybody help me Thank you forward...
Sean, Hungary
scjconsulting
Since ASP.NET 2.0 projects do not have project files, there is no place in the Microsoft Visual Studio 2005 IDE to define the conditional compilation symbols like there is in DLL and Windows Executable projects.
It turns out that you can define these constants in your web.config. The downside to this is that they are not bound to a specific build configuration and so you will either have to manually add/edit these constants in your web.config or add something to your build process to handle these constants. Just add the xml below to your configuration of your web.config to define the DEBUG constant and a custom MYCONST constant.
<system.codedom>
<compilers>
<compiler language="c#;cs;csharp" extension=".cs"
type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089"
compilerOptions="/d:DEBUG,MYCONST"/>
</compilers>
</system.codedom>