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

2

8

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.

Burble answered 27/6, 2014 at 16:12 Comment(3)
I think you should install this NuGet package.Amin
Thanks Gert but that is the one I have installed already. It is the System.Data.SqlServerCe.4.0 which is causing the problem at runtime as shown above.Burble
#19821784Disseminate
N
13

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 
Nauru answered 15/12, 2015 at 14:37 Comment(0)
S
2

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!

Sleeping answered 9/5, 2019 at 8:32 Comment(1)
I needed both of these answers. The package "EntityFramework.SqlServerCompact" needed to be installed in the same project as the EF Context, Migrations, etc. Note: A few months ago I had updated to a newer version of EF, but evidently didn't get "EntityFramework.SqlServerCompact" installed in the proper project.Dentifrice

© 2022 - 2024 — McMap. All rights reserved.