应用程序无法搭建项目

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);

这篇关于应用程序无法搭建项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

DispatcherQueue null when trying to update Ui property in ViewModel(尝试更新ViewModel中的Ui属性时DispatcherQueue为空)
Drawing over all windows on multiple monitors(在多个监视器上绘制所有窗口)
Programmatically show the desktop(以编程方式显示桌面)
c# Generic Setlt;Tgt; implementation to access objects by type(按类型访问对象的C#泛型集实现)
InvalidOperationException When using Context Injection in ASP.Net Core(在ASP.NET核心中使用上下文注入时发生InvalidOperationException)
LINQ many-to-many relationship, how to write a correct WHERE clause?(LINQ多对多关系,如何写一个正确的WHERE子句?)