How to stop the browser from closing automatically when stopping debugging on VS 2017

I am testing the new VS 2017 RC and wondering if anyone knows how to revert previous debugging behavior

In VS 2015, it went as follows:

Click the "Debug Launch" button

  • The website opens in a new Chrome tab.
  • Cancel debugging by clicking
  • The website is still open, and the website is still running / active.

Now in 2017:

  • Debugging to get started
  • The website opens in a new window that cannot dock with any other Chrome windows / tabs
  • Cancel debugging by clicking
  • Website / Chrome window closes, unable to continue using the site unless I manually go to the localhost window in Chrome

Is it possible to return to the style of 2015 in 2017? So the Chrome / Website window can dock with other Chrome windows / tabs and stay open after you stop debugging?

Also, I found that the new Chrome window is disappointing, as it seems to have no history and content. For example, I cannot autocomplete forms or URLs, which is very annoying when I try to validate a form

+236
visual-studio visual-studio-2017
Nov 21 '16 at 21:15
source share
6 answers

Visual Studio 2017 version 15.7 and higher and Visual Studio 2019 changed the situation again.

Disabling the following checkboxes will allow you to keep the browser open (it does not close after stopping debugging) and opens another tab (instead of another window):

enter image description here

enter image description here

Tools> Options> Debugging> General

  • Disable "Enable JavaScript debugging for ASP.NET (Chrome, Edge, and IE)."

Tools> Options> Projects and Solutions> Web Projects

  • (Visual Studio 2017) Disable "Stop the debugger when the browser window is closed."
  • (Visual Studio 2019) Disable "Stop the debugger when the browser window is closed, close the browser when debugging is stopped."
+410
May 9 '18 at 14:33
source share

The reason for the change in behavior is VS 2017 support for debugging JavaScript / TypeScript running in Chrome. See the announcement here https://blogs.msdn.microsoft.com/webdev/2016/11/21/client-side-debugging-of-asp-net-projects-in-google-chrome/

To return to the behavior of 2015 when Chrome is not closed by the debugger, disable the IE / Chrome script debugger in Tools -> Options, for example:

Debugger options

+80
Jan 03 '17 at 17:45
source share

I am writing this answer because, as I think, the previous ones cover only half of the problem.

First of all, you want to get rid of this annoying "run chrome in a new window and automatically close when you stop debugging",

Tools -> Options -> Uncheck Enable JavaScript Debugging for ASP.NET

After that, when you start debugging, chrome opens a new tab, after stopping, the tab does not close, but the refreshing website shows a white screen

again in Tools -> Options

uncheck Enable editing and continue

Since then, you have your previous behavior.

Options window

+16
Sep 16 '17 at 7:56 on
source share

There are two ways to do this:

  • Either start without debugging by pressing ctrl + f5, or
  • Run with debugging (press f5) and then go to the Debug menu and click "Disconnect All"

Hope this helps.

+2
Nov 22 '16 at 0:50
source share

For those of you who have updated Visual Studio 2019, this configuration is now in Tools> Options ...

And then in the options dialog box (see Image below) Projects and Solutions> Web Project:
Uncheck Stop debugger when broswer window is closed, close browser when debugging

enter image description here

+1
Apr 25 '19 at 20:06 on
source share

Open " Tools" → " Options" and find " Stop Debugger ". Then select the site’s web projects in the Projects and Solutions section. Uncheck " Stop the debugger when closing the browser window ." Before this option, you should apply the @jerone clause .

PS: This option can be used after version VS 15.7

0
Jul 22 '18 at 7:24
source share



All Articles