.net – Visual Studio 2008: How to redirect Trace, Debug and Console output to the Output window

debuggingnettracevisual studiovisual-studio-2008

I have noticed recently that the Visual Studio "Output window" stopped writing out my Debug.WriteLine messages in my WinForms application. It does neither output the Trace.WriteLine messages. I have also used DebugView while running this application and it shows nothing.

I am sure it worked in some VS projects some time ago – the output contained Debug messages. We also have a project that we regularly debug in production using the DebugView tool and it shows all Trace.WriteLine messages.

However, I just found out that currently in my Visual Studio, Console.WriteLine now writes to the VS Output window while the Trace and Debug.WriteLine do not.

How to control the redirections of Debug Trace and Console outputs within Visual Studio?

Best Answer

Trace, Debug, and Console go to the Output window if you select Debug in the Show output from drop down and the Program Output option is selected (right click in output window).

AFAIK console is only redirected to output for non-console applications. Check the project properties and make sure it says either Class Library or Windows Application in the output type drop down.