我在 VS 2013 Professional 中创建了一个 MVC 5 应用程序,然后首先将 EF 6.1 代码与 SQL Server Express 上的现有数据库结合使用。当我尝试创建 View 时,我使用“New scaffolded item...”然后选择“MVC 5 controller with views, using Entity Framework”。我选择模型和上下文类并单击确定。然后出现以下错误消息,并且没有创建代码。我已经卸载了 EF Power Tools 并出现同样的错误。
错误
There was an error running the selected code generator: ‘Exception has been thrown by the target of an invocation.’
我还尝试过卸载/重新安装 VS 2013 和 SQL Server,但不做任何更改。
关于可能导致此错误的原因还有其他想法吗?
最佳答案
在我的例子中,我将我的连接字符串从 Web.config 移到了
<connectionStrings configSource="ConnectionStrings.config"/>
当我尝试构建脚手架时开始出现错误。
There was an error running the selected code generator: ‘Exception has been thrown by the target of an invocation.’
将我的连接字符串移回 Web.config 解决了我的问题。
关于c# - 应用程序不能搭建项目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23576294/