How to disable browser launching on build and launch in .NET Core

I am developing web API with .NET Core on macOS with deployment on Linux. I am absolutely not interested in using the browser. However, when building and working with Visual Studio Code (debug or not), the browser is launched every time .

I need to close the tab, remove the browser from the path, go to Paw, where I am actually testing the API, and then go back to VS Code.

It's really annoying to do this every time.

Is there any configuration to disable browser startup?

thank

+9


source to share


3 answers


Short answer

Open the file .vscode/launch.json

and disconnect launchBrowser

.

More details

  • dotnet new webapi

  • Open VS Code.
  • Add the required assets for building and debugging.


At this point there is a directory .vscode

containing the file launch.json

. Open this 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

+15


source


Just to add, it works for Visual Studio 2017 too (not just VS Code). The file is called launchSettings.json and is located inside the project's Properties folder.



+1


source


Changed in version 0.2.0.

Just comment out the following lines.

// "serverReadyAction": {
//     "action": "openExternally",
//     "pattern": "^\\s*Now listening on:\\s+(https?://\\S+)"
// },

      

0


source







All Articles