Stop Visual Studio from launching a new browser wi

2019-01-05 08:35发布

I already have a window open with the web site I'm debugging. I don't need VS to launch another one for me every time I need to debug.

Is there a way to stop this behavior?

13条回答
爱情/是我丢掉的垃圾
2楼-- · 2019-01-05 09:13

As I did not had the mentioned option in my VS which is Visual Studio Enterprise 2017, I had to look for some other option.

Here is it what I've found:

Go to Tools -> Options -> Debugging tab(General) and uncheck "Enable JavaScript debugging for Asp.Net(Chrome and IE).

enter image description here

查看更多
甜甜的少女心
3楼-- · 2019-01-05 09:14

In an ASP.Net 5 project this can now be set for each launch profile.

Open the file launchsettings.json under the Startup Project Properties folder and add "launchBrowser": false to the profile you are configuring, such as in:

"profiles": {
    "IIS Express": {
      "commandName": "IISExpress",
      "launchBrowser": false,
      "environmentVariables": {
        "Hosting:Environment": "Development"
      }
    }
}
查看更多
手持菜刀,她持情操
4楼-- · 2019-01-05 09:18

For VS 15.7.1 ToolsOptionsProjects and SolutionsWeb Projects → uncheck Stop debugger when browser window is closed.

查看更多
啃猪蹄的小仙女
5楼-- · 2019-01-05 09:19

You can right click on your project, then choose Properties , on Debug tab you should uncheck launch browser checkbox.

查看更多
小情绪 Triste *
6楼-- · 2019-01-05 09:21

When you first open a web/app project, do a Ctrl-F5, which is the shortcut for starting the application without debugging. Then when you subsequently hit F5 and launch the debugger, it will use that instance of IE. Then stop and start the debugging in Visual Studio instead of closing IE.

It works on my machines. I'm using the built in dev web server. Don't know if that makes a difference.

Firefox will also stay open so you can debug in either or both at the same time.

查看更多
Luminary・发光体
7楼-- · 2019-01-05 09:23

Updated answer for a .NET Core Web Api project...

Untick the 'Launch browser' checkbox (enabled by default).

enter image description here

查看更多
登录 后发表回答