How to disable browser launch when building and running in .NET Core
asp.net-core, visual-studio-code
Solution
Short Answer
Open the `.vscode/launch.json` file and disable `launchBrowser`.
More Details
- `dotnet new webapi`
- Open VS Code.
- Add required assets to build and debug.
At this point, there is a `.vscode` directory that contains a `launch.json` file. Open that file and disable or delete the following.
"launchBrowser": {
"enabled": true,
"args": "${auto-detect-url}",
"windows": {
"command": "cmd.exe",
"args": "/C start ${auto-detect-url}"
},
"osx": {
"command": "open"
},
"linux": {
"command": "xdg-open"
}
},
See also: https://code.visualstudio.com/docs/editor/debugging#_launch-configurations
Problem
I'm developing a Web API with .NET Core in macOS with deployment to Linux. I have absolutely no interest in using the browser. However, when building and running from Visual Studio Code (Debug or not), the browser launches every time. I have to close the tab, remove the browser out of the way, go to Paw, where I actually test the API, then go back to VS Code. It's really annoying doing this every time. Isn't there some configuration to disable browser launch? Thanks