SQL Server Compact 3.5 SP2 Private Deployment in separate folder in project tree fails
-
Wednesday, February 27, 2013 8:12 PM
I have a desktop .NET 4.0 C# application and I'm trying to do a private deployement of SQL Server Compact 3.5 SP2. I have followed the steps described in here, here and here and it worked fine. In an attempt to improve the configuration, I followed the instructions described in this post to isolate the SQL CE files in a separated folder. However, after doing that, the application no longer works. When I try to run it, I get the following error message:
Unable to load the native components of SQL Server Compact corresponding to the ADO.NET provider of version 8080. Install the correct version of SQL Server Compact. Refer to KB article 974247 for more details.
StackTrace: at System.Data.SqlServerCe.NativeMethods.LoadNativeBinaries()
at System.Data.SqlServerCe.SqlCeConnection..ctor()
at System.Data.SqlServerCe.SqlCeProviderFactory.CreateConnection()
at System.Data.EntityClient.EntityConnection.GetStoreConnection(DbProviderFactory factory)
at System.Data.EntityClient.EntityConnection.ChangeConnectionString(String newConnectionString)
at System.Data.EntityClient.EntityConnection..ctor(String connectionString)
at System.Data.Objects.ObjectContext.CreateEntityConnection(String connectionString)
at System.Data.Objects.ObjectContext..ctor(String connectionString, String defaultContainerName)
...
InnerException:
System.DllNotFoundException: Unable to load DLL 'sqlceme35.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
at System.Data.SqlServerCe.NativeMethods.GetSqlCeVersionInfo(IntPtr& pwszVersion)
at System.Data.SqlServerCe.NativeMethods.LoadValidLibrary(String modulePath, Int32 moduleVersion)
at System.Data.SqlServerCe.NativeMethods.LoadNativeBinaries()
StackTrace: at System.Data.SqlServerCe.NativeMethods.GetSqlCeVersionInfo(IntPtr& pwszVersion)
at System.Data.SqlServerCe.NativeMethods.LoadValidLibrary(String modulePath, Int32 moduleVersion)
at System.Data.SqlServerCe.NativeMethods.LoadNativeBinaries()
InnerException: nullHere is how the files are structured in the project:
The relevant entries in the "App.config" file:
<runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <probing privatePath="SqlCe35SP2"/> <dependentAssembly> <assemblyIdentity name="System.Data.SqlServerCe" publicKeyToken="89845dcd8080cc91" culture="neutral"/> <bindingRedirect oldVersion="3.5.1.0-3.5.1.50" newVersion="3.5.1.50"/> </dependentAssembly> </assemblyBinding> </runtime> <system.data> <DbProviderFactories> <remove invariant="System.Data.SqlServerCe.3.5"></remove> <add name="Microsoft SQL Server Compact Data Provider" invariant="System.Data.SqlServerCe.3.5" description=".NET Framework Data Provider for Microsoft SQL Server Compact" type="System.Data.SqlServerCe.SqlCeProviderFactory, System.Data.SqlServerCe, Version=3.5.1.50, Culture=neutral, PublicKeyToken=89845dcd8080cc91"/> </DbProviderFactories> </system.data>
I have checked the bin output and the files are corrected copied to it, mirroring the project tree.
Has any one got a clue on what is the problem here?
All Replies
-
Wednesday, February 27, 2013 8:45 PMModeratorI assume you have noticed the update to my blog post here, that private deployement with 3.5 and Entity Framework 4/5 does not Work http://erikej.blogspot.dk/2012/05/private-deployment-of-sql-server.html - use 4.0 or use Linq to SQL.
Please mark as answer, if this was it. Visit my SQL Server Compact blog
-
Thursday, February 28, 2013 4:12 PMErik, despite from being able to put the binaries in a separate folder in the project tree, the installation has worked well till now. Can you elaborate on what are the caveats with the private deployement of the SLQCe3.5 with EF4?
-
Friday, March 01, 2013 7:38 AMModerator
EF loads the 3.5 binaries from the GAC despite attempts to be isolated, and this can cause runtime errors due to version mismatches.Please mark as answer, if this was it. Visit my SQL Server Compact blog
- Marked As Answer by Arthununesq Friday, March 01, 2013 4:31 PM

