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

发布于 2024-12-17 05:53:44 字数 445 浏览 4 评论 0原文

简而言之,我只需在 Web 应用程序中添加一行:

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

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

在此处输入图像描述

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

To simply it, I just add one line in the Web Application:

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

What I want is to read "Hello, world!" on the output window in Visual Studio 2010, but failed, what's wrong?

enter image description here

I've tried:
change verbosity by Tools > Options > Project and Solutions > Build and Run and change values of "MSBuild project build output verbosity"
but without any effect.

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

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

发布评论

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

评论(3

单身狗的梦 2024-12-24 05:53:44

使用 Debug.WriteLine 而不是 < code>Console.WriteLine 如果您想在调试窗口中查看结果。

using System.Diagnostics;

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

Use Debug.WriteLine instead of Console.WriteLine if you want to see the result in the Debug window.

using System.Diagnostics;

void Application_Start(object sender, EventArgs e)
{
    Debug.WriteLine("Hello, world!");
}
毁虫ゝ 2024-12-24 05:53:44

您应该使用 Debug.WriteLine("Hello world") (位于 System.Diagnostics 命名空间中)输出到调试窗口。

You should use Debug.WriteLine("Hello world") (located in the System.Diagnostics namespace) to output to the debug window.

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