Jan 25

imagesWhen you are deploying an application that uses the Sql Server Compact Edition, you need to make sure the target machine is able to run the Compact Edition. There are two ways of doing this: a silent way that leaves no trace after uninstalling your application, and the transparent way that installs a separate instance of the Compact Edition.

The first way of doing this is to include a separate install to download and install the Sql Server Compact Edition. That way you offer the user the option of not downloading and installing it, should the Compact Edition already be configured on the target machine. The drawback of this is that when your application is uninstalled, the Sql Server Compact Edition is still resident on the target machine.

The second way, the silent way, is to add 7 dll’s from the installed Sql Server Compact Edition folder to your project, and build them as content and always copy them to the output directory. The dll’s are (this is for .Net 3.5):

  • sqlceca35.dll
  • sqlcecompact35.dll
  • sqlceer35EN.dl
  • sqlceme35.dll
  • sqlceoledb35.dll
  • sqlceqp35.dll
  • sqlcese35.dll
image

In this scenario you should also set the Copy Local property of the System.Data.SqlServerCe dll to True. Then, add an installer project to your solution, and set it to include both the primary output of your application project and also the content files of your application. That will include all the dll’s you need in the installation package. After installing, your application should have no problem using the Compact Edition!

Comments are closed.