Adding A New MVC 5 Controller with Views Using Entity Framework Scaffolding Error

浪子不回头ぞ 提交于 2019-12-13 04:51:18

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!