Alex Rivera | Logout

Could not load file or assembly 'System.Data.Entity

Asked 2011-02-16T19:36:31.390
17

I am working within a Solution (a jokes website). The Solution has 2 Projects:

  1. Model (C# Class Library)
  2. MVC 3 Empty Application

I am trying to get my view to list the Jokes in the Database, but I get the following error:

Could not load file or assembly 'System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified

As you can see from the Error message, I have already added the System.Data.Entity to the web.config of the MVC 3 application.

No matter what I do, I seem to be unable to fix the error! I have added using statements for the Entity class, to the HomeController and the Index.cshtml.

Edit
Report

1 Answer

3

I was getting the same error, and it was because the MVC3 project used Entity Framework 4.1, and my domain model (in a class library project, same solution) grabbed 4.2 when I added the reference. I uninstalled EF from my Web project, then reinstalled, now both have 4.2 and are working fine. Currently working with the Apress title, Pro ASP.NET MVC Framework (Freeman).

answered 2011-11-24T16:47:19.857

Your Answer