VS2010 + Entity FrameWork 4.4 +Mvc 4.0 出现的错误

时间:2021-07-20 06:38:59

Compiler Error Message: CS0012: The type 'System.Data.Objects.DataClasses.EntityObject' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.

头次碰到这个问题,google结果,需要修改web.config文件

添加配置节点

<configuration>
<system.web>
<compilation>
<assemblies>
<add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral,PublicKeyToken=b77a5c561934e089"/>
</assemblies>
</compilation>
</system.web>
</configuration>

http://*.com/questions/1501616/is-the-combination-of-ado-net-entity-framework-and-asp-mvc-wrong-by-any-chance

http://*.com/questions/3219412/strange-compilation-error-in-entity-framework-and-mvc-application