Why there are both EntityFramework and System.Data.Entity assemblies in my project?

.net entity-framework visual-studio-2012

Question

I just opened VS 2012 and created a class library project. After that I added a new ADO.NET Entity Data Model item to my solution.

I noticed there are both an assembly called EntityFramework 5.0 and another one called System.Data.Entity 4.0. Shouldn't it be just one?

As a bonus problem, when I click the file the designer crashes:

Error   2   Error 6039: warning CS1701: Assuming assembly reference 'System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' matches 'System.Data.Entity, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089', you may need to supply runtime policy
c:\Users\andre_pena\AppData\Local\Temp\5srvr0ge.0.cs(465,29) : error CS1061: 'System.Data.Metadata.Edm.EdmFunction' does not contain a definition for 'IsComposableAttribute' and no extension method 'IsComposableAttribute' accepting a first argument of type 'System.Data.Metadata.Edm.EdmFunction' could be found (are you missing a using directive or an assembly reference?)    c:\users\andre_pena\documents\visual studio 2012\Projects\ClassLibrary2\ClassLibrary2\Model1.edmx   1   1   ClassLibrary2

Is it everything ok with my system? Is the existence of both files normal? Why am I getting this error?

1
2
11/9/2012 6:39:32 PM

Accepted Answer

You should have both assemblies:

EntityFramework.dll (has DbContext API, Code First)

System.Data.Entity.dll (has ObjectContext and DbContext APIs, new features)

The need for two assemblies are to allow the Entity Framework team to release updates without waiting for the next official release of the .NET Framework.

EdmFunction.IsComposableAttribute is supported in .NET 4.5 so check the version of your System.Data.Entity.dll

enter image description here

And check the detailed answer here: https://stackoverflow.com/a/9694963/1241400

Tip:

If you want to use lambda with Include() add a using directive for System.Data.Entity .

6
5/23/2017 10:32:33 AM

Popular Answer

Regarding:

Error   2   Error 6039: warning CS1701: Assuming assembly reference 'System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' matches 'System.Data.Entity, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089', you may need to supply runtime policy

Uninstall Entity Framework June 2011 CTP. I blogged about this some time ago: http://blog.3d-logic.com/2012/04/11/entity-framework-zombie-a-k-a-microsoft-entity-framework-june-2011-ctp/ or it will haunt you to the end of your days (or until you pave your machine).



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