How to read result from Console.WriteLine() in Output window in Visual Studio 2010

freeflying picture freeflying · Nov 22, 2011 · Viewed 8.6k times · Source

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.

Answer

Oded picture Oded · Nov 22, 2011

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!");
}