[英]Adding A New MVC 5 Controller with Views Using Entity Framework Scaffolding Error
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:当我尝试在我的 web 应用程序项目中使用实体框架添加带有视图的 MVC 5 controller 时,当它尝试搭建脚手架时,我收到此错误:
"There was an error running the selected code generator: 'There was an error getting the type (name of entity model here).' “运行所选代码生成器时出错:'获取类型时出错(此处为实体 model 的名称)。” Try rebuilding the project."
尝试重建项目。”
I did previously switch from MVC 4 to MVC 5, which perhaps could be at the root of this error.我之前确实从 MVC 4 切换到 MVC 5,这可能是这个错误的根源。 Any help is appreciated, thanks.
任何帮助表示赞赏,谢谢。
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. 遇到类似问题的时候,我可以通过完全关闭Visual Studio并重新打开解决方案来修复它。 You should also make sure you rebuild your solution, if you haven't already tried the advice the error gives you.
如果还没有尝试过错误给出的建议,则还应确保重建解决方案。
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. 因此,如果我首先创建一个新的数据实体模型,将构建配置从x64更改为x86,进行重建,清理解决方案,然后重新启动Visual Studio,则能够通过脚手架生成控制器和视图。
Frustrating that it comes down to that. 令人沮丧的是,归结为这一点。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.