I'm trying to deploy a small Windows Form app that uses a SQL Server CE 4.0 database. I don't want every system running this application to have to install SQL Server CE 4.0, so I'm trying to get any required DLLs included with the application.
When I check the references list, the only reference for SQL Server CE 4.0 is System.Data.SqlServerCe
. Including the DLL for that, System.Data.SqlServerCe.dll
, still leads to the following error when attempting to connect to the database:
Unable to load the native components of SQL Server Compact corresponding to the ADO.NET provider of version 8876. Install the correct version of SQL Server Compact. Refer to KB article 974247 for more details.
I've seen a few articles talking about this for different versions of SQL Server CE, but they listed DLLs for other versions, as far as I could tell. The systems the app will be running on should all have at least Windows 7 with .NET 4.0 installed, if that makes a difference.
I tried the steps located here to add the files as shown in the link: http://erikej.blogspot.com/2011/02/using-sql-server-compact-40-with.html
With those files included in the build, the program compiles without any errors, but when run on a secondary system, the GUI never appears (part of the public Form1() includes a method that grabs data from the SQL CE database) and the program just closes after a couple of seconds. The event viewer shows this error:
Faulting application name: Dispatch Review Assistant.exe, version: 1.0.0.0, time stamp: 0x50915d3c Faulting module name: KERNELBASE.dll, version: 6.1.7601.17932, time stamp: 0x503285c2 Exception code: 0xe0434352 Fault offset: 0x000000000000caed Faulting process id: 0x1028 Faulting application start time: 0x01cdb78c10761c73 Faulting application path: C:\Users\deLucain\Desktop\Release\Dispatch Review Assistant.exe Faulting module path: C:\Windows\system32\KERNELBASE.dll Report Id: 4e4f45e3-237f-11e2-bd76-14dae92102de
We had the same error message showing up when doing a private deployment (ie including libraries in application folder) of SQLCE 4.0 application.
When adding references to our project, we had added the x64 and x86 folders (and associated dlls) as per the documentation.
At this point, we got the error :
Unable to load the native components of SQL Server Compact corresponding to the ADO.NET provider of version 8876. Install the correct version of SQL Server Compact. Refer to KB article 974247 for more details.
In our environment, we found that the amd64 folder found under :
%Program Files%\Microsoft SQL Server Compact Edition\v4.0\Private
was also needed.
After adding it to the project and referencing the contained dlls, our issue was resolved.