Sam
Sam

Reputation: 5677

Error scaffolding an API Controller with Actions and Entity Framework

I am going through this tutorial here: https://learn.microsoft.com/en-us/aspnet/core/tutorials/first-web-api?view=aspnetcore-6.0&tabs=visual-studio and running Visual Studio Community version 16.9.2.

When I try to add a scaffolded item, controller with API actions and Entity Framework, it says: "There was an error running the selected code generator: 'Install the package Microsoft.VisualStudio.Web.CodeGeneration.Design and try again." The package, however, is already installed. I have cleaned and rebuilt the solution. And I restarted Visual Studio and then tried rebooting my machine. Nothing seems to help.

Seems like this happened to me before but I think rebooting the machine worked. Not this time. I may try uninstalling and reinstalling the package.enter image description here

Upvotes: 0

Views: 1249

Answers (2)

MeanChicken
MeanChicken

Reputation: 31

Just posting this here if someone ever runs in to the issue, it will always fail if there is an error message. Try to re-build the solution and see if that fixes it and then try again.

Upvotes: 0

Sam
Sam

Reputation: 5677

It finally worked after uninstalling and reinstalling the package.

Upvotes: 0

Related Questions