title: Not able to scaffold a controller in ASP.NET Core Web API
body: <p>I'm trying to scaffold controller for Entity Framework Core using ASP.NET Core Web API 3.1.</p>
  <p>My database works fine, I can add new migrations and update the actual database.</p>
  <p>The problem is that, once I install the packages and try to scaffold a new controller, the package version from <code>5.0.3</code> goes down to <code>3.1.12</code> for <code>EntityFramework.Tools</code> and <code>EntityFramework.SqlServer</code>.</p>
  <p>What happens is that, I install the required versions of <code>EntityFrameworkCore</code>, <code>EntityFrameworkCore.Design</code>, <code>EntityFramework.Tools</code> and <code>EntityFramework.SqlServer</code>, in my case I install them as <code>5.0.3</code> version. Once installed, I'm trying to scaffold a new controller with entity framework like this:</p>
  <ol>
  <li>Click right mouse on the Controllers folder and click <code>Add</code></li>
  <li>Select <code>New Scaffold Item</code></li>
  <li>Select <code>API Controller with actions, using EntityFramework</code></li>
  </ol>
  <p>Unfortunately, I'm not able to create a controlled. I'm getting the error below:</p>
  <blockquote>
  <p>There was an error running the selected Code Generator: 'Unhandled Exception: System.TypeLoadException: Could not load type 'Microsoft.VisualStudio.Web.CodeGeneration.ConsoleLogger' from assembly Microsoft.VisualStudio.Web.CodeGeneration.Core, Version=1.1.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.<br />
  at Microsoft.VisualStudio.Web.CodeGeneration.Tools.Program.Main(String [] args)</p>
  </blockquote>
  <p>What I've tried:</p>
  <ol>
  <li>Clearing Nuget cache</li>
  <li>Uninstalling and installing all the packages all over again</li>
  <li>Updating visual studio version</li>
  <li>Adding additional attributes to my csproj file for the actual packages.</li>
  <li>Creating a new empty project, installing the packages and scaffolding a controller. It still does not work??</li>
  <li>Reinstalling visual studio</li>
  </ol>
  <p>This stack question did not help me:</p>
  <p><a href="https://stackoverflow.com/questions/44975449/asp-net-core-1-1-1-mvc-with-ef-core-not-able-to-scaffold-from-controller-class">ASP.NET Core 1.1.1 MVC with EF Core - not able to scaffold from controller class</a></p>
  <p>I don't understand. I update my packages versions to <code>5.0.3</code> but once I try to scaffold a new controller, the package versions are being downgrade to <code>3.1.12</code> automatically.</p>
  <p>How is this possible? Any additional ideas, how I could fix this issue?</p>