I am using Visual Studio with ASP.NET Core and run the web site using just F5 or Ctrl+F5 (not using command line directly). I would like to use the \"dotnet watch\" function
Just one little correction to @Flynn`s answer. You need to add an
"commandName": "Executable"
argument to the "Watch" profile. Also to define the urls you should define them not in the "Watch" profile, but in the profile with
"commandName": "Program"
argument (it is present in the default launchsettings.json
, created by the Visual Studio project templates, so, your launchsettings.json
finally looks like this:
"AnyTest.WebClient": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"launchUrl": "",
"applicationUrl": "https://localhost:44353;http://localhost:51895",
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}"
},
"Watch": {
"commandName": "Executable",
"workingDirectory": "$(ProjectDir)",
"executablePath": "dotnet.exe",
"commandLineArgs": "watch run"
}
I kept the launchBrowser
argument in the Program
profile, but browser in not launched. But if this argument is present in the Executable
profile, the browser is not launched too and I found no way to launch it automatically.