ASP.Net Web 表单编译显示缺少实体框架参考
我有一个使用 ASP.Net Webforms 和实体框架的网站,在编译期间 VS2010 告诉我以下错误:
错误 CS0012:类型“System.Data.Objects.DataClasses.EntityObject”在未引用的程序集中定义。您必须添加对程序集“System.Data.Entity,Version=3.5.0.0,Culture=neutral,PublicKeyToken=b77a5c561934e089”的引用。
问题是在 web.config 中正确配置了引用
,项目的属性页显示项目中使用的 Framework 版本是 v3.5,这是正确的。
任何帮助将不胜感激。
这是我的 web.config 中的程序集部分
<assemblies>
<add assembly="System.Runtime.Remoting, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="System.Web.Extensions.Design, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Data.Entity, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
</assemblies>.
I have a website using ASP.Net Webforms and Entity Framework and during compilation VS2010 tells me the following error:
error 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=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.
The problem is that the reference is properly configured in web.config
The properties page of the project says that the Framework version used in the project is v3.5, which is correct.
Any help will be appreciated.
This is the assemblies section in my web.config
<assemblies>
<add assembly="System.Runtime.Remoting, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="System.Web.Extensions.Design, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Data.Entity, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
</assemblies>.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我唯一一次遇到这种情况是当项目中缺少 DLL 时,而且它可能不仅仅是根项目。如果您有另一个使用 EntityObject 类的项目,并且其中缺少该类,您将收到错误消息。
The only time I get that is when the DLL is missing from a project, and it may not just be the root project. If you have another project that uses the EntityObject class, and its missing there, you'll get the error.
你能显示你的 web.config 参考吗?我的猜测是版本 # 已关闭,或者 EF 组件可能未安装在 GAC 中。
can you show your web.config references? My guess is that either the version # is off, or that perhaps the EF assmebly is not installed in the GAC.