Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ADO.NET provider with invariant name 'System.Data.SqlServerCe.4.0' could not be loaded

The Entity Framework provider type 'System.Data.Entity.SqlServerCompact.SqlCeProviderServices, EntityFramework.SqlServerCompact' registered in the application config file for the ADO.NET provider with invariant name 'System.Data.SqlServerCe.4.0' could not be loaded. Make sure that the assembly-qualified name is used and that the assembly is available to the running application.

Above is the error message I am getting when trying to create metadata with Breeze / Entity Framework. Nuget seems to have messed something up but it is not obvious what and it is not obvious where it is trying to read the assembly from. Any ideas would be most welcome.

like image 201
Oldergit Avatar asked Jun 27 '14 16:06

Oldergit


2 Answers

I had the same problem. You have installed Sql Compact but you are missing the EntityFramework extension for Sql Compact. You need to install it via package manager console or nuget package manager. The console script is :

Install-Package EntityFramework.SqlServerCompact 
like image 91
Ognyan Dimitrov Avatar answered Nov 04 '22 05:11

Ognyan Dimitrov


I was getting this error message when trying to run the update-database command in package manager console against an EF code first project. When searching for this particular error message, I kept landing back on this questing but installing the EntityFramework.SqlServerCompact nuget did not resolve it in my scenario.

The solution for me was to make sure the default start up project is not set to multiple start up projects (in my case it needs to be the web project) and the default project in package manager is set to the EF project you're trying to run migrations from.

I'm posting this solution to help anyone that runs into the same issue I had as I couldn't find a solution here and this is the first question that comes up.

I'll probably be back to this question myself in a couple of months when I forget and make the same mistake!

like image 44
JordanGW Avatar answered Nov 04 '22 04:11

JordanGW