Visual Studio Do not open new browser instance

when I try to run a web application in visual studio 2017RC on windows 10, it opens a new browser instance(in my case chrome). I’ve tried also with internet explorer, situation is same, and browser not signed in, but if I just manually run chrome it is signed in.
How to prevent visual studio to run a new browser instance on each time I run web application? When I press run website it should be opened in same window as previous application(just next tab)

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

I’ve discovered that Turning off Javascript debugging means that sites open in a new tab of an existing Chrome instance. From what I’ve seen the in Visual Studio debugging is not as good as Chrome’s dev tools so turning this off is not an issue for me.

Visual Studio Do not open new browser instance

UPDATE

As of VS2017 15.7.1 (and still the case in VS2019 16.0.0 and VS2022 17.0.0 PREVIEW) this fix no longer works and I’ve found I’ve had to additionally uncheck Stop debugger when browser window is closed

Visual Studio Do not open new browser instance

Method 2

There is solution to that problem.
Very Simple please follows the below Steps.

  • Open Visual Studio
  • Go to “Tools” and then go to “Options”
  • Select “Projects and Solutions” and in that select “Web Projects”
  • Please uncheck this Option “Stop debugger when browser window is closed, close browser when debugging stops”
  • Click Ok

Now start project, it will not open in new chrome Instant but in a already running Chrome Instant.

Method 3

You can disable the website from being launched at all from the debug settings.

ProjectSettings-Debug

Once the web application is running you can launch the website from the taskbar.

enter image description here

The “Browse With…” menu option appears to launch the website without running the debug session in VS2017 which might not be what you want.

Method 4

I wanted to share the reason of the issue as well as the screen shot.
The reason for which it opens a new window is because JS debugging is enabled. Chrome is launched with debugging enabled so a new instance is required. If you want to revert to the old behavior from Visual Studio 2015, you can do so but you would have to disable JS debugging. See below:

enter image description here

Original Source

Original Discussion on Visual Studio Forum

Method 5

I prefer to set mine like this, I run the page from where I want (no new instance or tab opening)

Project Properties Window

Method 6

This workaround works for me for VS 2019

Tools => Options

Then type Projects and Solutions in the search box.

Then Select Web Project.

Then deselect the below option.

Stop debugger when browser windows is closed, close browser when debugging stops.

This works for me. Hope this will help.

Method 7

Have a look into this link. you will find solution for your question and some more information about what happens when you start/stop debugging and when you close the browser window

Method 8

In VS 2022 the option:
Stop debugger when browser window is closed,
was moved to:
Tools>>Options>>Web Package Managment>>Web Projects

Visual Studio Do not open new browser instance


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x