2017-07-14 54 views
0

将项目从网站项目转换为Web应用程序项目后,站点无法运行抱怨global.asax无法编译因为:全局asax无法编译“模块system.data.entity version = 4.0.0.0应引用”

Compiler Error Message: CS0234: The type or namespace name 'Entity' does not exist in the namespace 'System.Data' (are you missing an assembly reference?) 

但我引用System.Data.Entity。如果我删除导入行并直接引用它,我会得到:

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'. 

但是我引用了System.Data.Entity。

我试图从引用和删除它重新添加了好几次,以及删除我的/ bin中/文件夹,并重新编译等

我也曾尝试手动引用/v4.0/系统.Data.Entity dll而不是来自/v4.5/的默认版本,但这也不起作用。

+0

是否https://stackoverflow.com/questions/9972426/the-type-or-namespace-name-entity-does-not命名空间 - 系统 - 数据的帮助? – mjwills

+0

不,没有,我也尝试过。我有一个更新 - Web应用程序是.net 4.5,它调用的项目是.net 4.0。我相信这不应该是一个问题,但尽管具有相同的版本标签(v4.0.0.0),但system.data.entity dll看起来不同。 – Eterm

回答

0

添加下面的固定这个问题的web.config:

<compilation debug="true" targetFramework="4.5"> 
    <assemblies> 
     <add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" /> 
    </assemblies> 
</compilation> 
相关问题