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

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


当前回答

打开启动项目的属性(project→{ProjectName} properties…从主菜单或在“解决方案资源管理器”中右键单击项目并选择“属性”),然后导航到“Web”选项卡,在“开始操作”下选择“不打开页面”。等待来自外部应用程序的请求。

您仍然可以使用任何浏览器(或Fiddler,无论什么)来访问正在运行的应用程序,但它不会自动打开浏览器窗口,它只是在后台启动并等待任何请求。

其他回答

这个变通方法对我来说适用于VS 2019

工具=>选项

然后在搜索框中键入项目和解决方案。

选择Web项目。

然后取消下面的选项。

关闭浏览器窗口时停止调试器,调试停止时关闭浏览器。

这对我很有用。希望这能有所帮助。

.NET核心Web Api项目的更新答案…

右键单击项目,选择“属性”,转到“调试”,取消“启动浏览器”复选框(默认启用)。

I looked over the answers and didn't see the solution I found mentioned. If it was, my apologies. In my case, currently using Visual Studio 2015. In the solution explorer, right click on the Project file and click properties. Go to the Debug tab and this should have info for how you're launching "IIS Express or Web(DNX)" for the first two drop downs, and then there should be a checkmark box for "Launch URL:". Uncheck this option and your browser won't be automatically launched everytime you go to debug your application. Hope this helps someone out.

Joao Costa的答案同样适用于。net core 2项目。

launchsettings。json——> "launchBrowser": false

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

看起来2022年的维密秀已经改变了,

现在它有一个专门的用户界面,

右键单击项目(在解决方案资源管理器中)>选择属性,然后遵循:-


“uncheck”选项不自动打开。

或者您可以单击菜单栏,调试>属性

你可以直接从那里到达第二步“启动配置文件”

或者一个捷径:

选择项目(在解决方案资源管理器中)并按Alt + Enter,然后从那里开始。