我正在使用macOS开发带有.NET Core的Web API,并将其部署到Linux。我对使用浏览器完全没有兴趣。但是,如果从Visual Studio代码构建和运行(是否调试),则每次启动时,浏览器都会启动。
我必须关闭选项卡,移开浏览器,进入Paw,在这里我实际测试了API,然后回到VS Code。
每次都这样做很烦人。
是否没有禁用浏览器启动的配置?
谢谢
最佳答案
简短答案
打开.vscode/launch.json
文件并禁用launchBrowser
。
更多细节
dotnet new webapi
此时,存在一个
.vscode
目录,其中包含一个launch.json
文件。打开该文件,然后禁用或删除以下内容。"launchBrowser": {
"enabled": true,
"args": "${auto-detect-url}",
"windows": {
"command": "cmd.exe",
"args": "/C start ${auto-detect-url}"
},
"osx": {
"command": "open"
},
"linux": {
"command": "xdg-open"
}
},
另请参阅:https://code.visualstudio.com/docs/editor/debugging#_launch-configurations
关于asp.net-core - 在.NET Core中构建和运行时如何禁用浏览器启动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43957547/