1 Introduction

Our general development process is code–>compile–>run–>debug–>location problem—>modify code–>compile–>…, looping back and forth, but hard work, but in fact The heart is very resistant. Introduce the tool under the .NET Core platform today – dotnet watch. It is used to monitor project file changes in real time. If there are file changes, the project will be automatically recompiled and run, which greatly saves us time for recompilation and debugging.

2. Instructions for use

  1. Install the

    NuGet package
  2. The console dotnet watch runcan be executed .

However, if you use the VS Code operation, you will encounter the following error:

  1. Error NU1605: Detected package downgrade: Microsoft.NETCore.App from 2.0.6 to 2.0.0. Reference the package directly from the project to select a different version.
  2. No executable found matching the command “dotnet-watch”

The first problem is because the NuGet package we installed by default is the latest version, and the latest version is 2.0.1, which depends on:

So we need to check Microsoft.NETCore.Appthe version, my condition is 2.0.0 does not meet (>=2.0.6), here I choose to install the 2.0.0 version of the Watch, the command line executes:
dotnet add package Microsoft.DotNet.Watcher.Tools –version 2.0.0. Of course, you can also upgrade and install version 2.0.6 or above Microsoft.NETCore.Appto solve this problem.

For the second question, we need to manually modify the project csproj file. Add a DotNetCliToolReferencenode.
<DotNetCliToolReference Include=”Microsoft.DotNet.Watcher.Tools” Version=”2.0.0″ />

Orignal link:https://www.jianshu.com/p/5c11d7601044