在所选文件中找不到源自DbContext的可构造类型(EF Power Tools Beta 2 + VS 2012) [英] A constructible type deriving from DbContext could not be found in the selected file (EF Power Tools Beta 2 + VS 2012))

查看:56
本文介绍了在所选文件中找不到源自DbContext的可构造类型(EF Power Tools Beta 2 + VS 2012)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用VS 2012(终极版)以及Entity Framework Power Tools Beta 2和Entity Framework 5.0(使用nuget)。

I'm using VS 2012 (Ultimate) together with Entity Framework Power Tools Beta 2 and entity framework 5.0 (using nuget).

我创建了一个DbContext类。当我在解决方案资源管理器中右键单击相应文件并选择实体框架/视图实体数据模型(只读)时,出现错误在选定文件中找不到源自DbContext的可构造类型。 VS 2012中出现错误。

I've created a DbContext class. When I right-click on the corresponding file in the solution explorer and select "Entity Framework / View Entity Data Model (Read-only)", I get the error "A constructible type deriving from DbContext could not be found in the selected file." error in VS 2012.

我尝试了 http://blogs.msdn.com/b/adonet/archive/2012/04/09/ef-power-tools -beta-2-available.aspx ,但我的注册表在 HKEY_CURRENT_USER\软件\Microsoft\VisualStudio\11.0_Config中不包含键 {BFC24BF4-B994-4757-BCDC-1D5D2768BF29} \BindingPaths\。

I tried the workaround described at http://blogs.msdn.com/b/adonet/archive/2012/04/09/ef-power-tools-beta-2-available.aspx, but my registry does not contain the key "{BFC24BF4-B994-4757-BCDC-1D5D2768BF29}" in "HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\11.0_Config\BindingPaths\".

重新启动Visual Studio并执行相同的步骤后,将弹出一个对话框,指示调用目标已抛出异常。

After restarting visual studio and following the same steps, a dialog pops up indicating "Exception has been thrown by the target of an invocation".

BTW。我可以执行从DbContext创建数据库的测试应用程序,O可以在该数据库中插入/删除/ etc数据。

BTW. I'm able to execute my test application that creates the database from my DbContext and O can insert/delete/etc data in this database.

任何帮助/提示将不胜感激。

Any help/hints would be very appreciated.

亲切的问候,
Merijn

Kind regards, Merijn

推荐答案

为Visual Studio 2012卸载 VSCommands 应该会使事情再次起作用。不幸的是,此扩展程序不能与EF Power Tools很好地配合使用。它将自己版本的EntityFramework.dll加载到VS主过程中,从而阻止了DbContext发现逻辑正常工作。

Uninstalling VSCommands for Visual Studio 2012 should get things working again. Unfortunately, this extension does not play nicely with the EF Power Tools. It loads it's own version of EntityFramework.dll into the main VS process which prevents the DbContext discovery logic from working properly.

这篇关于在所选文件中找不到源自DbContext的可构造类型(EF Power Tools Beta 2 + VS 2012)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆