Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Entity Framework method not found; version issue?

I'm working on a system built by another developer. When I run the project I get the following error at run time. Is this an Entity Framework method? Is it from a specific version? I'm not sure how to track down the source of this error.

System.MissingMethodException: Method not found: 'Void System.Data.Entity.ModelConfiguration.EntityTypeConfiguration`1.ToTable(System.String)'.

like image 339
user1202839 Avatar asked May 27 '15 21:05

user1202839


3 Answers

What I have seen happen in the past, is different projects in the solution referencing different versions of EF. I would go through each project, and make sure they reference the same version of EF.

Or simply right click on

Solution -> Manage NuGet Packages -> Updates -> Entity Framework

and this will update all of the projects to latest EF.

like image 70
Michal Ciechan Avatar answered Oct 22 '22 03:10

Michal Ciechan


The EntityTypeConfiguration<T>.ToTable(String) method is new in the Entity Framework 5 which is the first release of EF that is separate from the rest of the .NET Framework.

Your project/solution is probably referencing the Entity Framework built-in to the .NET Framework which would be version 4. Ensure you have the correct EF binaries referenced.

like image 2
Dai Avatar answered Oct 22 '22 01:10

Dai


Had to restart Visual Studio in my case.

like image 1
JDandChips Avatar answered Oct 22 '22 02:10

JDandChips