如何在 ASP.NET 网站项目中定义 TRACE 编译标志?

发布于 2024-11-03 08:08:09 字数 135 浏览 10 评论 0原文

如何在 ASP.NET 网站项目中定义 TRACE 编译标志?我可以找到的 Visual Studio 中没有 .proj 文件,也没有任何构建对话框中的选项。

我正在使用 Visual Studio 2008 和 ASP.NET 2.0。

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 and ASP.NET 2.0.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

心作怪 2024-11-10 08:08:09

阅读本文:

演练:将 ASP.NET 跟踪与 System.Diagnostics 跟踪集成

http://msdn.microsoft.com/en-us/library/b0ectfxd%28v=VS.80%29.aspx

查找副标题“在启用跟踪的情况下自动编译应用程序”

您需要在 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>

这是 web.config 中编译器部分的文档,尽管它没有提及 Trace 内容:

http://msdn.microsoft.com/en-us/library/y9x69bzw%28v=VS.80%29.aspx

我刚刚尝试过,它对我有用。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文