Blog from Saravanan Arumugam

Let us talk about Technologies

The type ‘System.Data.Objects.DataClasses.EntityObject’ is defined in an assembly that is not referenced


I am working on an MVC 3 application where I use an Entity Object as the model to the View. I was getting the following error in the browser.

Exception

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

Solution:

It was interesting that the MVC project by default has the reference to System.Data.Entity namespace. But still the issue was presented. I finally figured out the clue from another word press blog. I had to add the assembly entry in the Web.config to resolve the issue.

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

Note that the complete assembly name is presented in the exception message itself.

Advertisements

2 responses to “The type ‘System.Data.Objects.DataClasses.EntityObject’ is defined in an assembly that is not referenced

  1. zohaib August 4, 2012 at 4:58 pm

    Entity Framework bug can be resolved by simply add refrence to the solution file.the refence we need to add is “System.Data.Entity “.Apply by right Click on the solution file

  2. Pingback: Assembly ‘windowsbase Version=3.0.0.0 Culture=neutral Publickeytoken=31bf3856ad364e35′ | Technology Documents

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s

%d bloggers like this: