I am trying to add a migration (for the first time) to a project using Entity Framework 6.0.2 for SQL Server Compact (code first). The application is having no problems comm
I just spent half a day trying to get SqlServerCe 4.0 SP1 aka 4.0.0.1 to work without above exceptions. Finally solved, hope it'd help someone else.
Copy "Program Files (x86)\Microsoft SQL Server Compact Edition\v4.0\Private" amd64
and x86
to bin
folder of your web app and include them in project (so that they become deployable)
Do not copy "System.Data.SqlServerCe.dll" and "System.Data.SqlServerCe.Entity.dll"
web.config
answers above are valid BUT "Version=4.0.0.1" didn't work for me, instead just "4.0"
<system.data>
<DbProviderFactories>
<remove invariant="System.Data.SqlServerCe.4.0" />
<add name="Microsoft SQL Server Compact Data Provider 4.0" invariant="System.Data.SqlServerCe.4.0" description=".NET Framework Data Provider for Microsoft SQL Server Compact" type="System.Data.SqlServerCe.SqlCeProviderFactory, System.Data.SqlServerCe, Version=4.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" />
</DbProviderFactories>
</system.data>
Remove the binding redirect. It looks like you are trying to use private deployement, but are you using the correct System.data.SqlServerCe.dll (check the Assembly version). if it is 4.0.0.0 and not 4.0.0.1, then change to DbProviderfactories setting to point to the correct assembly version