The type 'System.Data.Entity.DbContext' is defined in an assembly that is not referenced. You must add a reference to assembly 'EntityFramework 2

后端 未结 10 631
无人共我
无人共我 2021-02-02 05:37

I\'ve got one solution - the one project is class library with .edmx data model The other is asp.net web forms project.

when i start the solution I get the following e

相关标签:
10条回答
  • 2021-02-02 06:11

    The error message is telling you that the class library with .edmx data model has the Entity Framework 5 loaded ... (obviously because there are no error messages in the .edmx) ... and your web project is referencing the class library ... so it has access to everything in the class library ... but it cannot handle the data types in the class library because your web project needs a reference to the Entity Framework 5. You will also notice that your intellisense doesn't work for the objects in your class library either.

    Simply add a reference in your web project to the entity framework 5 ... and your all set.

    0 讨论(0)
  • 2021-02-02 06:12

    Do this, it will solve the issue as it seems you have not installed Entity Framework properly or it is not working properly, Go to TOOLS > Library Package Manager > Package Manager Console in VS2012 and typed install-package EntityFramework

    0 讨论(0)
  • 2021-02-02 06:16

    I ran into this problem when I pulled a project from SVN to a new computer. Installing Entity Framework via NuGet solved the problem. I installed the most current version which is now 6.1.1

    0 讨论(0)
  • 2021-02-02 06:17

    If someone has more than one project, you need to install it to the projects that require it. Also what helped me was changing the default project and then installing via package manager console and that resolved it.

    0 讨论(0)
  • 2021-02-02 06:23

    I already had the correct version of the entity framework DLL, and none of the other answers here worked for me: I had to select the EntityFramework reference in the project, then in the properties, set "Specific Version" to true.

    0 讨论(0)
  • 2021-02-02 06:27

    I suggest you to check:

    Allow NuGet to download missing packages during build ticked please refer this link

    0 讨论(0)
提交回复
热议问题