EntityFramework, version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 is incompatible with .net framework 4

entity-framework-6

Question

I have recently upgraded all solutions in my project to EF6 alpha3 but one of my projects is missing the EntityFramework.dll and EntityFramework.SQLServer.dll references. Naturally this is causing an error when I run the application, but when I try to manually add the references to the solution I get the error message: "EntityFramework, version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 is incompatible with .net framework 4"

My other solutions' application settings are .net 4 and they are not having this problem. What other setting or problem could be causing this? I am not sure what code or examples to attach here, so please request as needed. Thank you.

Accepted Answer

EF6 has separate dlls for each .NET Framework version it supports (i.e. .NET Framework 4 and .NET Framework 4.5). When you manually added the reference you probably referenced the dll that is meant for .NET Framework 4.5. The best way to add EF6 to your project is by using nuget. It will install the correct version of the EF6 dll depending on what .NET Framework version you target in your project.




Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Is this KB legal? Yes, learn why
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Is this KB legal? Yes, learn why