问题
When I try to add a MVC 5 controller with views using entity framework in my web app project, as it attempts to scaffold, I am getting this error:
"There was an error running the selected code generator: 'There was an error getting the type (name of entity model here).' Try rebuilding the project."
I did previously switch from MVC 4 to MVC 5, which perhaps could be at the root of this error. Any help is appreciated, thanks.
回答1:
Times when I've encountered something similar, I've been able to fix it by simply closing Visual Studio completely and re-opening the solution. You should also make sure you rebuild your solution, if you haven't already tried the advice the error gives you.
回答2:
So I am able to generate controllers and views via scaffolding if I first create a new data entity model, change my build configuration from x64 to x86, do a rebuild, clean the solution, and then restart Visual Studio.
Frustrating that it comes down to that.
来源:https://stackoverflow.com/questions/28703019/adding-a-new-mvc-5-controller-with-views-using-entity-framework-scaffolding-erro