Visual Studio 2019新项目控制台窗口闪退及调试按钮显示异常问题求助
Hey there, I’ve dealt with exactly this kind of Visual Studio quirk before—let’s get your new project working properly again!
First: Fix the "Start" Debug Button Issue
The fact that your debug button shows "Start" instead of your project name is a key clue: your new project isn’t set as the Startup Project in your solution. Here’s how to fix that:
- Go to the Solution Explorer (usually on the right side of Visual Studio).
- Right-click your new project name (not the solution itself).
- Select Set as Startup Project from the menu.
After doing this, the debug button should now display your project’s name instead of "Start". Try debugging again—this alone often fixes the console window closing problem.
If the Console Still Closes Too Fast:
If setting the startup project doesn’t stop the console from flashing closed, you can add a quick pause to your code or use a different debug method:
- Add a pause in code: At the end of your
Mainmethod, add eitherConsole.ReadLine();orConsole.ReadKey();. This tells the program to wait for user input before exiting, keeping the console window open. - Use "Start Without Debugging": Press
Ctrl+F5instead of the debug button. Visual Studio automatically adds a pause at the end of execution when you use this mode, showing "Press any key to continue..." so you can see your output.
Double-Check Project Debug Settings
If you’re still having issues, verify your project’s debug configuration:
- Right-click your project → select Properties.
- Go to the Debug tab.
- Make sure the Start action is set to Start project (not "Start external program" or "Start URL").
That should cover all the common fixes for this problem. Let me know if you run into any snags!
内容的提问来源于stack exchange,提问作者Tuan Dat

