Visual Studio Do not open new browser instance

78,399

Solution 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.

Turn off javascript debugging

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

enter image description here

Solution 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.

Solution 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.

Solution 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

Solution 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

Share:
78,399

Related videos on Youtube

ovasylenko
Author by

ovasylenko

Data scraping

Updated on July 08, 2022

Comments

  • ovasylenko
    ovasylenko almost 2 years

    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)

    • Alexan
      Alexan over 7 years
      you want it to open new tab?
    • ovasylenko
      ovasylenko over 7 years
      @Alex, how to prevent opening new instance, not a tab, another process...
    • ovasylenko
      ovasylenko over 7 years
      In which menu I can find this? api.monosnap.com/rpc/file/… . This is it?
    • Alexan
      Alexan over 7 years
      yes, I just thought that maybe your default is incognito browser
    • ovasylenko
      ovasylenko over 7 years
      @Alex, no my browser is not in incognito by default
    • ovasylenko
      ovasylenko over 7 years
      @Alex, I've just added a screencast
    • Alexan
      Alexan over 7 years
      if you press Ctrl+F5 (without debugging), what you get?
    • ovasylenko
      ovasylenko over 7 years
      @Alex, if just Ctrl+F5 than it works fine. Do you have any idea how to fix it for debug?
    • Alexan
      Alexan over 7 years
      yes, the same for me. Maybe debugger needs separate process to be attached to it.
    • Alexan
      Alexan over 7 years
  • ovasylenko
    ovasylenko over 7 years
    I don't want to disable launching. I just want to prevent opening new browser windows each time I run my application. When I press run website it should be opened in same window as previous application (just next tab)
  • Lee Oades
    Lee Oades about 7 years
    I know this answer didn't answer the OPs question, but it helped me :-)
  • Optimus1
    Optimus1 over 6 years
    It was as simple as noticing that there was a specific debugging option for Chrome and experimenting.
  • niico
    niico about 6 years
    It was already off for me - and it's still launching a new browser window instead of tab.
  • HaveSpacesuit
    HaveSpacesuit about 6 years
    @niico Did you just install VS 15.7.0? I suspect it is a bug in the latest release.
  • niico
    niico about 6 years
    I did indeed. I also just installed 15.7.1 and it's still doing it.
  • Optimus1
    Optimus1 about 6 years
    I've just updated to 15.7.1 am now getting a new window open.
  • Optimus1
    Optimus1 about 6 years
    @niico Updated answer restores the functionality of opening in an existing browser (for me at least).
  • Mutton92
    Mutton92 about 6 years
    Thanks for the update! I've updated to 15.7.1 and the update fix works in the latest version for me too
  • Alisson Reinaldo Silva
    Alisson Reinaldo Silva about 6 years
    @HaveSpacesuit I believe it's not a bug, but rather intentional. In order to stop debugger when browser window is closed, I guess they had to open a brand new browser window (I'm not sure, though). That's why disabling this new feature makes the project to open in a new tab on existing browser.
  • Matt Frear
    Matt Frear about 6 years
    Thanks for the 15.7.1 update. This is a VS bug imo. VS should have the "stop debugger when browser window is closed" unchecked by default so that it acts the same as previous versions
  • doterik
    doterik over 3 years
    After the post you refer to was written, this is the correct answer.
  • Ogglas
    Ogglas over 2 years
    Same thing for VS 2022
  • Adam Diament
    Adam Diament over 2 years
    Works for VS 2022 in 2022