title: SQL Server CE 4.0 deployment issue--which files are necessary?
body: <p>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. </p>
  
  <p>When I check the references list, the only reference for SQL Server CE 4.0 is <code>System.Data.SqlServerCe</code>. Including the DLL for that, <code>System.Data.SqlServerCe.dll</code>, still leads to the following error when attempting to connect to the database:</p>
  
  <blockquote>
    <p><em>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.</em></p>
  </blockquote>
  
  <p>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.</p>
  
  <p>I tried the steps located here to add the files as shown in the link: <a href="http://erikej.blogspot.com/2011/02/using-sql-server-compact-40-with.html" rel="noreferrer">http://erikej.blogspot.com/2011/02/using-sql-server-compact-40-with.html</a> </p>
  
  <p>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:</p>
  
  <blockquote>
    <p>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</p>
  </blockquote>