The type 'System.Data.Objects.ObjectContext' 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'

Today, I was developing an web application, I got titled error. I decided to post the fix for this.

You receive this error because you have not used references in your project to use System.Data.Entity namespaces.

To including the Entity Framework in your application, you must have a reference to the System.Data.Entity namespace so that you have access to the core functionality of the Entity Framework. These classes enable you to query, insert, update, and delete data.

  • In Solution Explorer, right-click References and select Add Reference from the right-click menu.
  • The Reference Manager dialog box is displayed.
  • Select System.Data.Entity from the list in the dialog box if it is not already selected. Make certain the checkbox next to the item is selected.
  • Click OK.

This process adds the System.Data.Entity.dll assembly to your project. It also allows you to reference the System.Data.Entity namespace from anywhere in your project.

Comments

  1. thank you! :p , that was giving me a headache.

    ReplyDelete
  2. Thanks dear for the post... JD

    ReplyDelete
  3. So simple. Thank you for restoring my partial loss of sanity.

    ReplyDelete
  4. I tried it but yet received same error Like " CS0012: The type 'System.Data.Objects.ObjectContext' 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'."

    ReplyDelete

Post a Comment

Popular posts from this blog