3

The following line of code is throwing the following error when i try to load the page:

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

@Html.DropDownListFor(model => model.Courses.Id, Model.CourseList)

In MVC3, I remember fixing this easily by adding the following line in the web.config file:

<add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />

However in MVC4 you cannot use the tag anymore, so I'm not sure how I can resolve it. Any help is greatly appreciated.

1
  • Project -> references -> right-click -> add reference Commented Jul 25, 2014 at 18:31

4 Answers 4

8

nvm, I was wrong you have to open up the tag and add the tag yourself.

Solution:

<compilation debug="true" targetFramework="4.0">
  <assemblies>
      <add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
    </assemblies>
  </compilation>
Sign up to request clarification or add additional context in comments.

Comments

1

Add a reference to Entity Framework in your MVC project. That should fix the issue.

Comments

1

This solution has worked for me:

<compilation debug="true" targetFramework="4.5"> <assemblies> <add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> </assemblies>

Comments

0

Load User Profile in the Application Pool Advance Settings.

This approach solved this for me.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.