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
But running project on a machine without SQL Server Compact installed throws
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 22.214.171.124.
So I have manually changed
System.Data.SqlServerCe.dll reference in my project to 126.96.36.199 file form the Private folder and copied
System.Data.SqlServerCe.dll 188.8.131.52 to the production machine.
I have changed
app.config like that:
<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=184.108.40.206, Culture=neutral, PublicKeyToken=89845dcd8080cc91"/> </DbProviderFactories> </system.data>
Now I get this exception on development machine:
The connection given is not of type 'SqlCeConnection'.
On production machine I get
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?
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: