Where can I read the Console output in Visual Studio 2015

C#Visual StudioConsoleVisual Studio-2015

C# Problem Overview


I am new to C# and downloaded the free version of Microsoft Visual Studio 2015. To write a first program, I created a Windows Forms Application. Now I use Console.Out.WriteLine() to print some test data. But where can I read the console?

C# Solutions


Solution 1 - C#

The simple way is using System.Diagnostics.Debug.WriteLine()

Your can then read what you're writing to the output by clicking the menu "DEBUG" -> "Windows" -> "Output".

Solution 2 - C#

in the "Ouput Window". you can usually do CTRL-ALT-O to make it visible. Or through menus using View->Output.

Solution 3 - C#

You can run your program by: Debug -> Start Without Debugging. It will keep a console opened after the program will be finished.

enter image description here

Solution 4 - C#

What may be happening is that your console is closing before you get a chance to see the output. I would add Console.ReadLine(); after your Console.WriteLine("Hello World"); so your code would look something like this:

static void Main(string[] args)
    {
        Console.WriteLine("Hello World");
        Console.ReadLine();

    }

This way, the console will display "Hello World" and a blinking cursor underneath. The Console.ReadLine(); is the key here, the program waits for the users input before closing the console window.

Solution 5 - C#

My problem was that I needed to Reset Window Layout.

Reset Window Layout

Solution 6 - C#

Once the app is running you can just select the project as demonstrated below: enter image description here

Solution 7 - C#

You should use Console.ReadLine() if you want to read some input from the console.

To see your code running in Console:

In Solution Explorer (View - Solution Explorer from the menu), right click on your project, select Open Folder in File Explorer, to find where your project path is.

Supposedly the path is C:\code\myProj .

Open the Command Prompt app in Windows.

Change to your folder path. cd C:\code\myProj

Change to the debug folder, where you should find your program executable. cd bin\debug

Run your program executable, it should end in .exe extension.

Example:

myproj.exe

You should see what you output in Console.Out.WriteLine() .

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionGarrarufaView Question on Stackoverflow
Solution 1 - C#owaircView Answer on Stackoverflow
Solution 2 - C#emoreau99View Answer on Stackoverflow
Solution 3 - C#AnatolyView Answer on Stackoverflow
Solution 4 - C#bmich72View Answer on Stackoverflow
Solution 5 - C#mobermeView Answer on Stackoverflow
Solution 6 - C#NemavhidiView Answer on Stackoverflow
Solution 7 - C#live-loveView Answer on Stackoverflow