添加一个新的MVC 5控制器与视图使用实体框架脚手架错误 [英] Adding A New MVC 5 Controller with Views Using Entity Framework Scaffolding Error
问题描述
当我尝试在我的Web应用程序项目中添加一个使用实体框架的视图的MVC 5控制器,因为它试图支架,我得到这个错误:
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."
我以前从MVC 4切换到MVC 5,这可能是这个错误的根源。谢谢任何帮助。
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.
推荐答案
所以我可以通过脚手架生成控制器和视图,如果我首先创建一个新的数据实体模型,改变我的构建配置从x64到x86,做一个重建,清理解决方案,然后重新启动Visual Studio。
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.
沮丧归结于此。
这篇关于添加一个新的MVC 5控制器与视图使用实体框架脚手架错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!