Gerard Simpson
Gerard Simpson

Reputation: 2126

macOS - No executable found matching command "dotnet-watch"

I am using the dotnet cli with macOS Sierra 10.12.6

I have typed this command:

dotnet new web

dotnet run

So far so good.

When I have change:

app.Run(async (context) =>
            {
                await context.Response.WriteAsync("Hello World");
            });

as per: https://www.youtube.com/watch?v=aIkpVzqLuhA and refresh the browser, nothing happens. I thought that this might need the watch package, so typed:

dotnet add package Microsoft.DotNet.Watcher.Tools --version 2.0.0

Which installs successfully; csproj contains:

 <ItemGroup>
    <PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.5" />
    <PackageReference Include="Microsoft.DotNet.Watcher.Tools" Version="2.0.0" />
  </ItemGroup>

when I try to run dotnet watch or dotnet watch run, I get the error:

No executable found matching command "dotnet-watch"

Upvotes: 0

Views: 542

Answers (1)

Martin Ullrich
Martin Ullrich

Reputation: 100751

The CLI tool needs to be referenced as DotNetCliToolReference instead of PackageReference:

<ItemGroup>
    <DotNetCliToolReference Include="Microsoft.DotNet.Watcher.Tools" Version="2.0.0" />
</ItemGroup> 

Currently, there is no CLI command to add a DotNetCliToolReference. In .NET Core 2.1, the watch command may be included with the CLI and the tools installation experience will be different (dotnet watch will be a global tool instead of a project-local tool).

Upvotes: 2

Related Questions