When trying to scaffold a controller (ApiControllerWithContextScaffolder), I get this error: 'No executable found matching command "dontnet-aspnet-codegenerator"'. I'm trying to install Microsoft.VisualStudio.Web.CodeGeneration.Tools using NuGet on Visual Studio 2017 CE. But I get the above error message.
@lordfkiller, Installing CLI tools via NuGet is currently not supported.
You would have to add the below lines manually to the csproj file in order to install the tool.
<ItemGroup>
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="1.0.0" />
</ItemGroup>
@prafullbhosale Thanks, worked! I could have sworn that I had tried this and not once. In fact this is in a text file that Visual Studio creates the first time you try to create an MVC controller.
On a side note, I have installed Entity Framework Core, including some of its CLI tools (e.g., migrations) using NuGet. Having said that, I can't install dotnet ef with NuGet (same error).
@prafullbhosale Is the same thing supposed to work for Microsoft.EntityFrameworkCore.Tools.DotNet? I've added the line and still can't use dotnet-ef (The term 'dotnet-ef' is not recognized as the name of a cmdlet, function etc.)
Yes, the same DotNetCliToolReference Include should work for Microsoft.EntityFrameworkCore.Tools.DotNet as well.
The only thing I can think of for dotnet-ef is that you would need to make sure that the console's working directory is the same as the project.
Closing this now. NuGet already has an issue to look into this: https://github.com/NuGet/Home/issues/4190
Most helpful comment
@lordfkiller, Installing CLI tools via NuGet is currently not supported.
You would have to add the below lines manually to the csproj file in order to install the tool.