Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Having the output of a console application in Visual Studio instead of the console

People also ask

How do I show console output in Visual Studio?

Press F11 . Visual Studio calls the Console. WriteLine(String, Object, Object) method. The console window displays the formatted string.

How do I run a console application in Visual Studio?

Build and run your code in Visual Studio To run the code, on the menu bar, choose Debug, Start without debugging. A console window opens and then runs your app. When you start a console app in Visual Studio, it runs your code, then prints "Press any key to continue . . ." to give you a chance to see the output.

How do I view console WriteLine output in Visual Studio 2022?

In Visual Studio uppermost menu choose Debug > Windows > Output. It shows all Console. WriteLine("Debug MyVariable: " + MyVariable) when you get to them.

How do I find the output of a console WriteLine?

To make a console output visible, you need to change application type to "Console application". This is done in the project "Properties", first tab ("Application"). By the way, if you application was WPF or System.


In the Tools -> Visual Studio Options Dialog -> Debugging -> Check the "Redirect All Output Window Text to the Immediate Window".


In the Visual Studio Options Dialog -> Debugging -> Check the "Redirect All Output Window Text to the Immediate Window". Then go to your project settings and change the type from "Console Application" to "Windows Application". At that point Visual Studio does not open up a console window anymore, and the output is redirected to the Output window in Visual Studio. However, you cannot do anything "creative", like requesting key or text input, or clearing the console - you'll get runtime exceptions.


Use System.Diagnostics.Trace

Depending on what listeners you attach, trace output can go to the debug window, the console, a file, database, or all at once. The possibilities are literally endless, as implementing your own TraceListener is extremely simple.


It's time to check the latest release/s for Visual Studio, folks. The most suggested solution that did not work for some of you before might work now.

In Visual Studio 2017 (Release Version 15.4.2 and above), going to Tools > Options > Debugging > General > (Check Box) Redirect all Output Window text to Immediate Window has worked for me.

Few Notes:

  1. To see the Immediate Window, make sure that you are in Debugging mode.
  2. There should now be 3 other debugging tools available at your disposal, namely, Call Stack, Breakpoints, and Command Window, as shown below:

enter image description here

Best wishes!