SQL Server Compact error: Unable to load DLL 'sqlceme35.dll'. The specified module could not be found

老子叫甜甜 提交于 2019-12-04 05:19:09
Patrick Kafka

You don't need it to be in the GAC for SQL Server Compact to run, and it will pick them up from the application directory. There are several ways to deploy an SQL Server Compact project. The two main ways are:

  1. Deploying the SQL Server Compact redistributable installer with your project, but this way is painful and also can be unistalled by the end user, or upgraded by Windows updates and breaking your application.

  2. Including the DLL files in your application folder. Depending on the features of SQL Server Compact you are using (replication or whatever), there is a handful of DLL files to deploy in your application folder.

If you have SQL Server Compact installed on your machine, they are most likely located at "C:\Program Files\Microsoft SQL Server Compact Edition\v3.5". They can be added to the project in Visual Studio and then set their project output type to "copy always". And the main reference to System.Data.SqlServerCe that you have in your project references should have copy local set to true.

  • sqlceca35.dll
  • sqlcecompact35.dll
  • sqlceer35en.dll
  • sqlceoledb35.dll
  • sqlceqp35.dll
  • sqlcese35.dll

If you have these all set, then in your installer project all you have to include is the project output of this project and you're good. In my opinion this is the only way to go. It is a simple deployment, of a couple of files and you are in control of what DLL versions your application uses.

I hope that helps.

codeulike

I had a similar problem, a Visual Studio 2008 Windows application targeting 32-bit Windows XP and Windows Vista that used SQL Server Compact 3.5 SP1 - that then got this error when installed on 64-bit Windows 7:

Unable to load DLL 'sqlceme35.dll'. The specified module could not be found

I was embedding an MSI for SQL Server Compact into the installer for the application.

Following this rather confused discussion on MSDN revealed that I needed to use the 64-bit MSI for SQL Server Compact on 64-bit machines. D'oh! That is, from page Microsoft SQL Server Compact 3.5 Service Pack 1 and Synchronization Services for ADO.NET version 1.0 Service Pack 1 for Windows Desktop I needed SSCERuntime-ENU-x64.msi rather than SSCERuntime-ENU-x86.msi for 64-bit machines.

JimG

How to: Deploy a SQL Server Compact Edition Database with an Application should help, at least with your first two questions.

In general, I think you should not install anything in the GAC for a single application.

alwayslearning
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!