Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Console.WriteLine does not output to Output Window in VS 2017

In short: Console.WriteLine was working ok in VS 2015 but it is not working anymore in VS 2017.

In detail: I have some VB code using Console.Write that outputs ok to Output Window in VS 2015, even when configured as Release ( to contrast with Debug ) launched with Start Debugging ( in contrast with Start Without Debugging ).

Today I upgraded to VS 2017 ( Community version ), but the Console.Write is not working anymore in the same conditions as VS 2015.

Maybe I made some config in VS 2015 in the past, but I do not recall.

Can someone help me how to make Console.Write output to Output Window in the same conditions ( Release config launched with Start Debugging ).

Obs: Debug.Writeline works ok ( output to Output Window ) when you are in a Debug configuration. When you are in a Release config, Debug.Writeline, does not output (to Output Window) even if you launch with Start Debugging. The need (and so the question) is in the context of Start Debugging in a Release config.

like image 733
MarcioAB Avatar asked Mar 20 '17 15:03

MarcioAB


People also ask

How do I get console WriteLine output in Visual Studio?

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 fix the output window in Visual Studio?

Go to "Tools" -> "Options..." and under the "Projects and Solutions" tab expander, you can find a checkbox labeled "Show Output window when build starts". Check it to enable the output window/pane to appear automatically when you build your project.

How do I print from console WriteLine?

To print a message to the console, we use the WriteLine method of the Console class. The class represents the standard input, output, and error streams for console applications. Note that Console class is part of the System namespace. This line was the reason to import the namespace with the using System; statement.

How do I display output in Visual Studio?

To display the Output window whenever you build a project, in the Options dialog box, on the Projects and Solutions > General page, select Show Output window when build starts.


1 Answers

VS 2017 ( Community ) does not have "Hosting Process" as in VS 2015. In VS 2015 the "Hosting Process" can be enabled in the Debug panel of the Project Properties. With the "Hosting Process" is possible to output to Output Window ( when launching a Release config with Start Debugging ) using Console.WriteLine(). In VS 2017 there is no such enabler and so the Console.WriteLine() does not output to Output Window anymore.

Discovered that (System.Diagnostics.)Trace.WriteLine(Format(...)) outputs to Output Window in Release configs and can replace (System.)Console.WriteLine.

like image 66
MarcioAB Avatar answered Oct 26 '22 04:10

MarcioAB