ASP.net: 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’.

If you are using the .Net Entity Framework and you are passing those Entity Framework objects through controls in your UI (.aspx, .ascx) pages such as a Repeater control (using the ) you will most likely see the following 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=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089’.

You may have added the assembly to your web application’s References but I guess this is not enough. You must also add the reference to your web.config file. You can do this by adding the following line to your ‘compilation/assemblies’ section so it looks like the following:

           
               
               
               
               
       
           
       

Published by

Tim Clark

Experienced Business Owner, Chief Information Officer, Vice President, Chief Software Architect, Application Architect, Project Manager, Software Developer, Senior Web Developer, Graphic Designer & 3D Modeler, University Instructor, University Program Chair, Academic Director. Specialties: Ruby, Ruby on Rails, JavaScript, JQuery, AJAX, Node.js, React.js, Angular.js, MySQL, PostgreSQL, MongoDB, SQL Server, Responsive Design, HTML5, XHTML, CSS3, C#, ASP.net, Project Management, System Design/Architecture, Web Design, Web Development, Adobe CS6 (Photoshop, Illustrator)

11 thoughts on “ASP.net: 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’.

  1. Thanks schleichermann. I first thought that I only had to add the reference on the Reference folder, but I guess that it has to be done on the web.config file too. Thanks a lot.!

    Like

  2. This Post has helped me !

    I have been trying to use CAST to my Object “Product” and I have did reference in the “Add reference” but is not enough, like you said.

    I have added the reference in web.config and it works!

    Thanks so much!

    😉

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s