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);
这篇关于应用程序无法搭建项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:应用程序无法搭建项目


- WebMatrix WebSecurity PasswordSalt 2022-01-01
- MoreLinq maxBy vs LINQ max + where 2022-01-01
- C#MongoDB使用Builders查找派生对象 2022-09-04
- 如何用自己压缩一个 IEnumerable 2022-01-01
- 在哪里可以找到使用中的C#/XML文档注释的好例子? 2022-01-01
- 良好实践:如何重用 .csproj 和 .sln 文件来为 CI 创建 2022-01-01
- 带有服务/守护程序应用程序的 Microsoft Graph CSharp SDK 和 OneDrive for Business - 配额方面返回 null 2022-01-01
- C# 中多线程网络服务器的模式 2022-01-01
- Web Api 中的 Swagger .netcore 3.1,使用 swagger UI 设置日期时间格式 2022-01-01
- 输入按键事件处理程序 2022-01-01