Visual Studio Console Application

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

Run Your Client Server Application. Ensure Visual Studio is set to build in ‘ Debug ‘ mode and then build all projects by pressing ‘F6′. An alternative is to right click the Solution file in visual studio and select ‘ Build Solution ‘. Browse to the compiled directory for both the client and server application. Once the Console Application template is generated by Visual Studio, Navigate to Program.cs from Solution Explorer ( You can open it by Clicking 'View'- 'Solution Explorer'). Now to connect to SQL Server, we need to create an instance of SQLConnection and pass a connection string to it. Preventing console window from closing on Visual Studio C/C Console application. 1201.gitignore for Visual Studio Projects and Solutions. Open visual studio 2015/2017/2019 and then File - New - Project. Here from the left side, choose Templates - Visual C#. And then from the list of template choose Console Application. Make sure to choose the.net framework version to “.NET Framework 4.5.2 ” like below: Now our console application is ready, but to work with SharePoint.

For as long as I've been writing console applications, I've atthe end of Main I've always had a piece of code to requireuser input before exiting when in debug mode, in order to reviewany output before the window closes. Not an onerous task, butone I immediately do as soon as creating a new application.

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

When I ran the application I was in for two surprises - thefirst was the icon had changed, to a fetching purple. The secondwas, after the program had ran and displayed my usual '(Pressany key to exit.)' message, the console stayed open - withanother message to press a key to exit.

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

Visual Studio 2017 Console Application

Always a catch

Visual

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

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

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?

larry andrews

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.

Mix-Movie.com

Visual Studio Console Application C++

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.

Visual Studio Console Application Download

Alex

Visual Studio Console Application Not Showing

You could use this extension for redirection stdout into Visual Studio output window https://marketplace.visualstudio.com/items?itemName=NesviatypaskhaOleksii.VsConsoleOutput