我已经打开了一个窗口与我正在调试的网站。我不需要VS为我启动另一个每当我需要调试。

有没有办法阻止这种行为?


当前回答

您现在还可以通过单击Run按钮旁边的下拉箭头来访问Web属性!

点击“运行”旁边的下拉按钮 {项目名称}属性 点击左侧列表中的“Web” 在“开始操作”段下,单击“不打开页面”。

你都准备好了!

PS:这对我来说是有效的,我使用的是VS Professional 2019的16.5.5版本:)

其他回答

当你第一次打开一个web/应用程序项目时,按Ctrl-F5,这是启动应用程序而不调试的快捷方式。然后,当您随后按下F5并启动调试器时,它将使用该IE实例。然后在Visual Studio中停止并启动调试,而不是关闭IE。

它在我的机器上工作。我正在使用内置的开发web服务器。不知道这有什么区别。

Firefox也将保持打开状态,因此您可以同时在其中一个或两个中进行调试。

对于VS2022和ASP。NET核心:

另一个快捷方式是:单击右边绿色三角形按钮上的小下拉按钮,上面有项目名称,这通常会启动调试版本。然后是最后一个选项“{项目名}调试属性”,它直接启动专用的UI窗口。

从那里遵循@irf的建议:

“uncheck”选项不自动打开。

There seems to be one case in which none of the above but the following helps. I'm developing a project for Windows Azure cloud platform and I have a web role. There is indeed a radio button Don't open page in Project -> {Project name} properties... as was pointed out by Pawel Krakowiak, but it has no effect in my case whatsoever. However, there is the main cloud project in solution explorer and there is the Roles folder under it. If I right click my web role in this folder and choose Properties, I get another set of settings and on the Configuration tab there is the Launch browser for flag, after unchecking it a new browser window is not opened on application start up.

您可以使用“附加到进程”功能,而不是按F5。

这也可以让你在已知的工作部分中导航,而不会在下面加载VS调试器。

在ASP中。Net 5项目现在可以为每个启动配置文件设置。

打开文件launchsettings。在Startup Project Properties文件夹下添加"launchBrowser": false到你正在配置的配置文件中,例如:

"profiles": {
    "IIS Express": {
      "commandName": "IISExpress",
      "launchBrowser": false,
      "environmentVariables": {
        "Hosting:Environment": "Development"
      }
    }
}