This content has moved - please find it at

Although these pages remain accessible, some content may not display correctly in future as the new blog evolves.


New option in Visual Studio 2019 keeps console window open after debugging

For as long as I've been writing console applications, I've at the end of Main I've always had a piece of code to require user input before exiting when in debug mode, in order to review any output before the window closes. Not an onerous task, but one I immediately do as soon as creating a new application.

New features?

Today I created a new .NET Core console application in Visual Studio 2019 preview and added by code without a second thought.

When I ran the application I was in for two surprises - the first was the icon had changed, to a fetching purple. The second was, after the program had ran and displayed my usual "(Press any key to exit.)" message, the console stayed open - with another message to press a key to exit.

Visual Studio now automatically keeps console windows opening after the program ends

A small change, but a welcome one! And, just in case it's not to everyone's liking, there's even an option to disable the behaviour if you don't like it.

A new option for allow the console to automatically close has been added

Always a catch

Unfortunately, this new option doesn't seem to work for old school console applications using the full .NET Framework, so I'll continue adding my boilerplate blocks to any new .NET Framework console applications I create.

Update History

  • 2019-03-02 - First published
  • 2020-11-22 - Updated formatting

About The Author


The founder of Cyotek, Richard enjoys creating new blog content for the site. Much more though, he likes to develop programs, and can often found writing reams of code. A long term gamer, he has aspirations in one day creating an epic video game. Until that time, he is mostly content with adding new bugs to WebCopy and the other Cyotek products.

Leave a Comment

While we appreciate comments from our users, please follow our posting guidelines. Have you tried the Cyotek Forums for support from Cyotek and the community?

Styling with Markdown is supported



larry andrews

# Reply

This is quite messed up for console apps. The checkbox does nothing for a run under the debugger. It closes the output window whatever the checkbox is set to. This is the old behavior for debug runs. HOWEVER, for non-debug running of debug compilations, the new default if that the box is unchecked and the window closes immediately. Setting the checkbox (automatically close the console when debugging stops) changes the non-debug run to leave the console window open at the end of execution. Totally confusing and mislabeled. WORSE: if you are running Visual Studio 2017 also, the options apply there also, so you suddenly lose the output window in non-debug runs.


Richard Moss

# Reply


Thanks for taking the time to comment. I have to say, I didn't observe this behaviour myself. I never tried running non-debug builds as it is incredibly rare I build in release mode and then run it via Visual Studio, but my observations were it worked perfectly in debug mode for .NET Core console applications - I already noted that sadly it doesn't work for full .NET Framework applications, even in the RTM version (which is a shame, I still currently do more work in the full framework than core).

I don't have an answer on your woes with the output window either, while I'm currently running VS2019 on a fresh Windows install, prior to the RTM I was running both 2015 and 2017 and never identified any problems - the shells are seperate products with seperate configurations etc. That doesn't mean that VS2019 has some subtle bug of course, just that it's nothing I've experienced myself.

Richard Moss


# Reply

I had the same problem, when I created projects with the option "empty project", Create project as "Win32-console application" instead of "empty project". In the dialog which pops up now, you press "continue" and after that you may check the option "empty project" and press confirm. After that CTRL + F5 will open a console which does not close automatically.


# Reply

You could use this extension for redirection stdout into Visual Studio output window