asp.net mvc 4 编译错误 CS0012

CS0012: The type 'System.Data.Objects.DataClasses.EntityObject' is defined in an assembly that is not referenced
解决方案是在Web.Config中添加下面一行代码:
<add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />

<system.web>

<compilation debug="true" targetFramework="4.0">

<assemblies>

<add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />

<add assembly="System.Web.Helpers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />

<add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />

<add assembly="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />

<add assembly="System.Web.WebPages, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />

<add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />

</assemblies>

</compilation>

<authentication mode="Forms">

<forms loginUrl="~/Account/LogOn" timeout="2880" />

</authentication>

<pages>

<namespaces>

<add namespace="System.Web.Helpers" />

<add namespace="System.Web.Mvc" />

<add namespace="System.Web.Mvc.Ajax" />

<add namespace="System.Web.Mvc.Html" />

<add namespace="System.Web.Routing" />

<add namespace="System.Web.WebPages"/>

</namespaces>

</pages>

</system.web>

上一篇:setContentView R can not be resovled


下一篇:Object-C变量作用域 -- 笔记