asp.net - 如何在 Visual Studio 2010 的输出窗口中读取 Console.WriteLine() 的结果

标签 asp.net visual-studio-2010 console.writeline

为了简单起见,我只在 Web 应用程序中添加一行:

    void Application_Start(object sender, EventArgs e)
    {
        // Code that runs on application startup
        Console.WriteLine("Hello, world!");
    }

我想要的是阅读“Hello, world!”在 Visual Studio 2010 的输出窗口上,但失败了,怎么了?

enter image description here

我试过: 通过“工具”>“选项”>“项目和解决方案”>“构建和运行”更改详细程度,并更改“MSBuild 项目构建输出详细程度”的值 但没有任何效果。

最佳答案

使用Debug.WriteLine如果您想在调试窗口中查看结果,请代替 Console.WriteLine

using System.Diagnostics;

void Application_Start(object sender, EventArgs e)
{
    Debug.WriteLine("Hello, world!");
}

关于asp.net - 如何在 Visual Studio 2010 的输出窗口中读取 Console.WriteLine() 的结果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8228466/

相关文章:

c# - 来自 Telerik RAD Controls 的 JavaScript

visual-studio-2010 - TFS 缺少工作项类型更改请求

c# - 我怎么写 Console.Writeline ("\|\/\|/");并忽略 "Unrecognized escape sequence"错误?

c# - 我的类应该实现什么接口(interface)或方法来在 Console.WriteLine 中打印我想要的内容?

c# - 使用 Console.WriteLine() 的复杂 I/O

asp.net - 在网页上的 ReportViewer 控件中呈现时 Reporting Services 图表文本模糊

c# - 表之间的关系

asp.net - 基于 Ajax 的用户名可用性检查

visual-studio-2010 - 构建失败-TFS2008上的VS2010解决方案

c++ - MFC VC++ 自定义复选框图像