How to See Console.WriteLine Output in Visual Studio 2022
If you’re new to Visual Studio or just getting started with C#, it’s common to be confused when Console.WriteLine() doesn’t seem to show anything. Don’t worry — the output is there… you just need to know where to look.
In this post, we’ll walk through exactly how to view Console.WriteLine() output in Visual Studio 2022, and how to avoid the common pitfalls that hide the console window.
✅ Step 1 — Make Sure You Are Using a Console Application
Console.WriteLine() only works in a Console Application. If you accidentally created a Windows Forms or WPF project, the output will not appear in a console window.
How to check:
Open your project in Visual Studio.
In Solution Explorer, right-click on the project and select Properties.
Under Output Type, make sure Console Application is selected.
If it’s anything else (like Windows Application), change it to Console Application and rebuild.
✅ Step 2 — Run the Application (with Ctrl + F5)
To actually see the output, you need to run the app. There are two ways to do it:
Action | Shortcut | Result |
---|---|---|
Start with debugging | F5 | Runs the app and immediately closes the window when it finishes |
Start without debugging | Ctrl + F5 | Runs the app and keeps the console window open |
Most beginners use F5 and wonder why the console flashes and disappears.
Always use Ctrl + F5 if you want the console window to remain open after it finishes executing.
✅ Step 3 — Check the Output Window (Optional)
If the program starts and closes immediately, or if you’re using F5, you can still check the Output window in Visual Studio.
To open it:
View → Output
or press Ctrl + Alt + O
Scroll to the bottom — Visual Studio logs the console application output there as well.
💡 Bonus Tip — Add Console.ReadKey() or Console.ReadLine() at the End
To force the console window to wait for user input, add this line at the end of your Main method:
Console.ReadKey();
or
Console.ReadLine();
That way, the console stays open until you press a key.
🔧 Example
✅ Quick Summary
Console.WriteLine() works only in a Console Application.
Use Ctrl + F5 to start the app without debugging, and keep the console open.
Alternatively, add Console.ReadKey() at the end of your Main method.
You can also check View → Output in Visual Studio to see the output.
Top comments (0)