title: Visual Studio error: There was an error running the selected code generator
body: <p>When using the code generators for scaffolded items in Visual Studio 2019 Version 16.8.5 I get the error message:</p>
  <p>*There was an error running the selected code generator:
  'Package restore failed. Rolling back package for <em>PROJECT</em></p>
  <p>I've seen so many devs facing the same issue here on Stack Overflow, but the suggested solutions doesn't work for me. Here are an example project from Pluralsight with the issue.</p>
  <ol>
  <li>Clone: <a href="https://github.com/bjorkblom/.NETCORE" rel="nofollow noreferrer">https://github.com/bjorkblom/.NETCORE</a></li>
  <li>Create a folder named api in OdeToFood/Pages</li>
  <li>Right click on the folder and select &quot;Add -&gt; New scaffolded item...&quot;</li>
  <li>Choose &quot;API Controller with actions using Entity Framework&quot;</li>
  <li>Model Class: Restaurant (OdeToFood.Core)</li>
  <li>Data context class: OdeToFoodDbContext (OdeToFood.Data)</li>
  <li>Controller name: RestaurantsController</li>
  <li>Click &quot;Add&quot; and you'll get the error message.</li>
  </ol>
  <p>I've tried to downgrade both the project and entityframework to 3.1 and 2.1. Nothing is working.</p>