Fixing dotnet-aspnet-codegenerator error

Written by Mathew Grabau -

After reading the instructions just a bit closer, I finally solved the problems with ASP.NET Core Scaffolding. The Scaffolding feature initializes after first right-clicking on Controllers, then navigating to and clicking Add->Controller. Once the dialog was filled out (for example, with "CompanyController") it would fail with an an error

There was an error running the selected code generator: 'No executable found matching command "dotnet-aspnet-codegenerator"'

This was also affecting Razor Views. The solution is in the first step shown in ScaffoldingReadMe.txt (opens after the scaffolding is added):

  1. Add Scaffolding CLI tool to the project's .csproj file:
<ItemGroup>

    <DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="1.0.1" />

</ItemGroup>
Unparenthesized `a ? b : c ? d : e` is deprecated. Use either `(a ? b : c) ? d : e` or `a ? b : (c ? d : e)`
The error has been logged in /anchor/errors.log
Uncaught Exception

Uncaught Exception

Unparenthesized `a ? b : c ? d : e` is deprecated. Use either `(a ? b : c) ? d : e` or `a ? b : (c ? d : e)`

Origin

anchor/routes/site.php on line 280

Trace

#0 [internal function]: System\Error::shutdown()
#1 {main}