Overview
dotnet watch
is a file watcher. If the application supports hot reload, this command hot reloads the application whenever a code change is detected. If not, it restarts the application.
dotnet watch
can run any command dispatched via thedotnet
executable. If you can rundotnet COMMAND
, you can rundotnet watch COMMAND
.- While
dotnet watch
is running, you can force a restart from the shell with Ctrl+R. - Arguments passed after
--
are sent to the childdotnet
process. If runningdotnet watch run
, these arguments are options fordotnet run
.
Options
--list
— list all discovered files--no-hot-reload
— watch, but do not hot reload on change--non-interactive
— prevent console input from being requested
Files Watched by Default
All items in the Compile
, EmbeddedResource
, and Watch
groups of the project file that match these glob patterns:
**/*.cs
*.csproj
**/*.resx
wwwroot/**
To add or remove watched files:
SomeProject.csproj
<ItemGroup>
<Watch Include="**\*.js"
Exclude="bin\**\*" />
</ItemGroup>