Is my C # Entity Frameworks project chasing?

I am working on a .NET MVC solution and I am getting the below error when using the Package Manager Console in Add-Migration

or updating the SQL Server.

System.TypeInitializationException: The type initializer for "System.Data.Entity.SqlServer.SqlProviderServices" is throwing an exception. ---> System.TypeLoadException: Method "ExecuteAsync" of type "System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy" from assembly 'EntityFramework.SqlServer, Version = 6.0.0.0, Culture = neutral, PublicKeyToken = b77a5c561934e089'

Interestingly, the code works if it is run on a colleague's computer (i.e. when checked out from git) or when posted in a new project. The other projects in the solution work fine with the Package Manager Console.

When this project was created, Entity Framework 6.1.3 was installed before the .NET target was changed from 4 to 4.5. This appears to be the cause of the problem, as a new project created with the target framework set before the Entity Framework was installed works fine.

We tried:

  • Reinstall Entity Framework 6.1.3 (actually uninstalling and restoring all nuget packages)
  • Removing the local branch and deleting files from the filesystem before pulling the code (which is running on a colleague's computer) from git
  • Using nuget command line to clear all local cached packages
  • Many combinations of the above

In all cases, the error persists.

There needs to be a place where more project-related data or configurations are stored that are not managed with git and that are causing the error. Any ideas on where this data or configuration is stored?

+3


source to share


1 answer


I can't comment yet, I need 50 xp.



Anyway, please check your app / web config file, see if the EF version has changed. If so, you can remove them and add them manually from your packages folder.

0


source







All Articles