SQL Server Compact 错误:无法加载 DLL“sqlceme35.dll”。找不到指定的模块

发布于 2024-08-21 01:16:03 字数 1494 浏览 4 评论 0原文

我正在使用 Visual Studio 2008 C# 开发一个 Windows 窗体 应用程序,该应用程序使用 客户端上的 SQL Server Compact 3.5 数据库。客户端很可能是 32 位 Windows XP 或 Windows Vista 计算机。我正在使用标准 Windows Installer 项目,该项目创建 MSI 文件和 setup.exe 进行安装客户端计算机上的应用程序。我是 SQL Server Compact 的新手,所以以前不需要像这样分发客户端数据库。当我运行 setup.exe(在带有 SP2 和 Internet Explorer 7 的新 Windows XP 32 位上)时,它安装得很好,但是当我运行该应用程序时,出现此错误:

无法加载 DLL“sqlceme35.dll”。找不到指定的模块

我已经花了几个小时搜索这个错误,但我所能找到的只是与在 64 位 Windows 上安装相关的问题,而没有与我正在使用的普通 32 位 Windows 相关的问题。

安装应用程序将找到的所有依赖文件复制到指定的安装目录中,包括 System.Data.SqlServerCe.dll 文件(程序集版本 3.5.1.0)。数据库文件位于应用程序目录外名为“data”的目录中,它的连接字符串是

<add name="Tix.ieOutlet.Properties.Settings.TixLocalConnectionString" connectionString="Data Source=|DataDirectory|\data\TixLocal.sdf"  providerName="Microsoft.SqlServerCe.Client.3.5" />

我有一些问题:

  • 如果 DLL 文件位于同一目录(即应用程序本地目录)中,应用程序是否应该能够找到 DLL 文件,或者我是否需要将其安装在 GAC 中? (如果是这样,我可以使用 Windows Installer 在 GAC 中安装 DLL 文件吗?)
  • 为了使用 SQL Server Compact 数据库,我还需要随应用程序分发其他内容吗?
  • 还有其他 DLL 文件,例如用于将数据导出到客户端上的 Excel 的 MS interop。这些是否需要安装在 GAC 中,还是将它们放在应用程序目录中就足够了?

I'm developing a Windows Forms application using Visual Studio 2008 C# that uses an SQL Server Compact 3.5 database on the client. The client will most likely be 32 bit Windows XP or Windows Vista machines. I'm using a standard Windows Installer project that creates an MSI file and setup.exe to install the application on a client machine. I'm new to SQL Server Compact, so I haven't had to distribute a client database like this before now. When I run the setup.exe (on new Windows XP 32 bit with SP2 and Internet Explorer 7) it installs fine, but when I run the application I get this error:

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

I spent a few hours searching for this error already, but all I could find were issues relating to installing on 64 bit Windows and none relating to normal 32 bit that I'm using.

The install application copies the all the dependent files that it found into the specified install directory, including the System.Data.SqlServerCe.dll file (assembly version 3.5.1.0). The database file is in a directory called 'data' off the application directory, and the connection string for it is

<add name="Tix.ieOutlet.Properties.Settings.TixLocalConnectionString" connectionString="Data Source=|DataDirectory|\data\TixLocal.sdf"  providerName="Microsoft.SqlServerCe.Client.3.5" />

Some questions I have:

  • Should the application be able to find the DLL file if it's in the same directory, i.e. local to the application, or do I need to install it in the GAC? (If so, can I use the Windows Installer to install a DLL file in the GAC?)
  • Is there anything else I need to distribute with the application in order to use a SQL Server Compact database?
  • There are other DLL files also, such as MS interop for exporting data to Excel on the client. Do these need to be installed in the GAC or will locating them in the application directory suffice?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

笑咖 2024-08-28 01:16:03

您不需要将其置于 GAC 中即可运行 SQL Server Compact,它会从应用程序目录中选取它们。有多种方法可以部署 SQL Server Compact 项目。两种主要方法是:

  1. 在您的项目中部署 SQL Server Compact 可再发行安装程序,但这种方法很痛苦,而且可能会被最终用户卸载,或者通过 Windows 更新进行升级并破坏您的应用程序。

  2. 将 DLL 文件包含在您的应用程序文件夹中。根据您使用的 SQL Server Compact 的功能(复制或其他),您的应用程序文件夹中需要部署一些 DLL 文件。

如果您的计算机上安装了 SQL Server Compact,它们很可能位于“C:\Program Files\Microsoft SQL Server Compact Edition\v3.5”。可以将它们添加到 Visual Studio 中的项目中,然后将其项目输出类型设置为“始终复制”。项目引用中对 System.Data.SqlServerCe 的主要引用应将 copy local 设置为 true。

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

如果您已完成所有这些设置,那么在您的安装程序项目中,您只需包含该项目的项目输出即可。在我看来,这是唯一的出路。这是一个简单的部署,由几个文件组成,您可以控制应用程序使用的 DLL 版本。

我希望这有帮助。

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.

故事和酒 2024-08-28 01:16:03

我遇到了类似的问题,一个针对 32 位 Windows XP 和 Windows Vista 使用 SQL Server Compact 3.5 SP1 的 Visual Studio 2008 Windows 应用程序 - 当安装在 64 位 Windows 7 上时出现此错误:

无法加载 DLL“sqlceme35.dll”。找不到指定的模块

我正在将 SQL Server Compact 的 MSI 嵌入到应用程序的安装程序中。

遵循这个相当混乱的MSDN 上的讨论 显示我需要在 64 位计算机上为 SQL Server Compact 使用 64 位 MSI。噢!也就是说,从页面 适用于 Windows 桌面的 Microsoft SQL Server Compact 3.5 Service Pack 1 和 Synchronization Services for ADO.NET version 1.0 Service Pack 1 我需要 SSCERuntime-ENU-x64.msi而不是 64 位计算机的 SSCERuntime-ENU-x86.msi

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.

莫相离 2024-08-28 01:16:03

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文