SQL 服务器 CE 文件位置

SQL Server CE file location

我的项目文件夹结构有问题,它使用 SQL Server CE 3.5(私有部署)。下图显示了很好的文件夹结构(没有错误)

但我想按如下方式重新组织文件夹:

这会引发错误,"Unable to load the native components of SQL Server Compact corresponding to the ADO.NET provider of version 8080. Install the correct version of SQL Server Compact. Refer to KB article 974247 for..."

所以我尝试在我的配置文件中添加探测路径:

<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
  <probing privatePath="dll"/>
  <dependentAssembly xmlns="">
    <assemblyIdentity name="System.Data.SqlServerCe" publicKeyToken="89845dcd8080cc91" culture="neutral" />
    <bindingRedirect oldVersion="3.5.1.0-3.5.1.50" newVersion="3.5.1.50" />
  </dependentAssembly>
</assemblyBinding>

但没有成功。是否有机会强制我的代码检查这些文件夹中所需的 DLL?

不,SQL Server Compact 3.5 提供程序无法做到这一点,因为私有部署的文件夹检测机制存在一些缺陷。

4.0 版中私有部署的一些改进应该可以实现这一点,但我假设您使用 3.5 版是有原因的。