How to watch for file changes “dotnet watch” with Visual Studio ASP.NET Core

前端 未结 5 1062
花落未央
花落未央 2020-12-05 02:06

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

5条回答
  •  情深已故
    2020-12-05 02:48

    "Watch": {
      "commandName": "Project",
      "launchBrowser": true,
      "launchUrl": "http://localhost:5000/",
      "commandLineArgs": "watch run",
      "workingDirectory": "$(ProjectDir)",
      "executablePath": "dotnet.exe",
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      }
    }
    

    This one will work and launch the browser too. It works because of the "commandName": "Project" line, which means it will be launching with the Kestrel server.

提交回复
热议问题