How do you define the TRACE compile flag in a ASP.NET Web Site project?
How do you define the TRACE compile flag in a ASP.NET Web Site project? There is no .proj-file and there are no options in any Build-dialogs in Visual Studio that I can find.
I'm using Visual Studio 2008 a开发者_如何学JAVAnd ASP.NET 2.0.
Read this article:
Walkthrough: Integrating ASP.NET Tracing with System.Diagnostics Tracing
http://msdn.microsoft.com/en-us/library/b0ectfxd%28v=VS.80%29.aspx
Look for the subheading "To compile your application automatically with trace enabled"
You need to put something like this in your web.config:
<system.codedom>
<compilers>
<compiler language="c#;cs;csharp"
extension=".cs"
compilerOptions="/d:TRACE"
type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" warningLevel="1" />
<compiler language="VB"
extension=".vb"
compilerOptions="/d:Trace=true"
type="Microsoft.VisualBasic.VBCodeProvider, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</compilers>
</system.codedom>
Here's the docs on the compiler section in the web.config, though it does not mention Trace stuff:
http://msdn.microsoft.com/en-us/library/y9x69bzw%28v=VS.80%29.aspx
I just tried it and it works for me.
精彩评论