SQL Server Compact 4.0 private deployment with Entity Framework 6.0 and NuGet

deployment entity-framework-6 nuget-package sql-server-ce


I have standardly setup WPF project with Entity Framework 6 and SQL Server Compact 4.0 installed. When I build my project all the necessary files for SQL Server CE deployment are correctly copied to the Release folder, including System.Data.SqlServerCe.dll.

But running project on a machine without SQL Server Compact installed throws System.IO.FileLoadException.

In my development environment is the System.Data.SqlServerCe.dll loaded from GAC. I have found this reference, where the version numbers of dlls are explained: http://technet.microsoft.com/en-us/library/gg213826.aspx

I supposed that the version of System.Data.SqlServerCe.dll assembly form NuGet is

So I have manually changed System.Data.SqlServerCe.dll reference in my project to file form the Private folder and copied System.Data.SqlServerCe.dll to the production machine.

I have changed app.config like that:

      <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=, Culture=neutral, PublicKeyToken=89845dcd8080cc91"/>

Now I get this exception on development machine:

The connection given is not of type 'SqlCeConnection'.

On production machine I get System.Data.Entity.Core.EntityException.

Is there any chance to get private deployment working with NuGet and EF 6? Or is it necessary to copy manually all the files in x86, amd64 folders?

11/11/2013 7:16:19 PM

Accepted Answer

The System.Data.Entity.Core.EntityException was already problem within my app, I also forgot to change DB name after deployment.

I have followed this guide and it is working now:


10/31/2014 6:23:08 AM

Related Questions


Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow