I am using Visual Studio with ASP.NET Core and run the website using just F5 or Ctrl+F5 (not using the command line directly). I would like to use the "dotnet watch" functionality to make sure all changes are picked up on the fly to avoid starting the server again. It seems that with the command line you would use "dotnet watch run" for this, but Visual Studio uses launchSettings.json and does it behind the scenes if I understand it correctly.
How can I wire up "dotnet watch" there?
Best Answer
If you want to use ASP.NET 2.x or 3.x you need to change it a bit.
The watch tool is a global tool now and you don't need to add it as a reference any longer
The syntax is slightly different
For .Net 5 & 6
In VisualStudio 2019
Otherwise add this to your
launchSettings.json
:The automatically generated
profile
with"commandName":"Project"
has all the other properties needed:launchBrowser
,applicationUrl
,environmentVariables
,dotnetRunMessages
andhotReloadProfile
. Any modifications should be made there.Corresponding Blog-Post from Juan Cruz Fiant: https://dev.to/juxant/auto-refresh-with-dotnet-watch-for-asp-net-core-projects-20no