15 June 2017

Detect Changes Automatically with dotnet watch

Whenever you're running a .NET Core application and you want to detect source file changes and restart the app automatically, simply use dotnet watch command.

Just add Microsoft.DotNet.Watcher.Tools to the .csproj file like the one below:

    <DotNetCliToolReference Include="Microsoft.DotNet.Watcher.Tools" Version="1.0.0-msbuild3-final" />

Then, run the dotnet restore command to add the package to your project.

Next time you run your application, just add watch to your command like: dotnet watch run to detect changes and restart your application automatically.

No comments:

Post a Comment