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

.net entity-framework

Question

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 exception:

The type 'System.Data.Entity.DbContext' is defined in an assembly that is not referenced. You must add a reference to assembly 'EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.

and when I see the references in my asp.net project I see the reference to my class and I can't see reference to entity framework. But the problem is that entity framework is installed both in my class library and web project

1
47
7/12/2014 5:18:57 AM

Accepted Answer

I think your EntityFramework version was confused

Please download the correct version by using the NuGet package installer.

See this discussion for getting started: The type or namespace name 'DbContext' could not be found

And look this same problem and Answer : is Here

62
5/23/2017 12:10:38 PM

Popular Answer

I found this solution suitable for me.

Adding Entity Framework DLL Reference:-

  1. Go to c:\Program Files (x86)\Microsoft ASP.NET\ASP.NETMVC 4\Packages\EntityFramework 5.0.0-rc\lib\net45

  2. Add Entity framework DLL



Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow