Application can#39;t scaffold items(应用程序无法搭建项目)
问题描述
我在 VS 2013 Professional 中创建了一个 MVC 5 应用程序,然后首先将 EF 6.1 代码与 SQL Server Express 上的现有数据库一起使用.当我尝试创建视图时,我使用的是New scaffolded item...",然后选择MVC 5 controller with views, using Entity Framework".我选择模型和上下文类,然后单击确定.然后出现以下错误消息并且没有创建代码.我卸载 EF Power Tools 时出现同样的错误.
I created an MVC 5 application in VS 2013 Professional and then used EF 6.1 code first with an existing DB on SQL Server Express. When I try to create the views I’m using the "New scaffolded item…" then selecting the "MVC 5 controller with views, using Entity Framework." I select the model and context classes and click OK. Then the following error message appears and no code is created. I’ve uninstalled EF Power Tools with the same error.
错误
运行选定的代码生成器时出错:‘Exception has被调用的目标抛出.'
There was an error running the selected code generator: ‘Exception has been thrown by the target of an invocation.’
我还尝试卸载/重新安装 VS 2013 和 SQL Server,但没有任何更改.
I've also tried uninstalling/reinstalling VS 2013 and SQL Server with no changes.
关于可能导致此错误的任何其他想法?
Any other ideas about what might cause this error?
推荐答案
我也有这个问题,我通过在我的数据库上下文中调用 base.onModelCreating 解决了这个问题
I had this problem too, I solved the problem by calling the base.onModelCreating in my DB context
base.OnModelCreating(modelBuilder);
这篇关于应用程序无法搭建项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:应用程序无法搭建项目


基础教程推荐
- 全局 ASAX - 获取服务器名称 2022-01-01
- 首先创建代码,多对多,关联表中的附加字段 2022-01-01
- 从 VS 2017 .NET Core 项目的发布目录中排除文件 2022-01-01
- 是否可以在 asp classic 和 asp.net 之间共享会话状态 2022-01-01
- 在 VS2010 中的 Post Build 事件中将 bin 文件复制到物 2022-01-01
- 经典 Asp 中的 ResolveUrl/Url.Content 等效项 2022-01-01
- JSON.NET 中基于属性的类型解析 2022-01-01
- 错误“此流不支持搜索操作"在 C# 中 2022-01-01
- 如何动态获取文本框中datagridview列的总和 2022-01-01
- 将事件 TextChanged 分配给表单中的所有文本框 2022-01-01