新的 SQLite 混合程序集
以前,.NET SQLite 库可从 http://sqlite.phxsoftware.com
获取,但最近已被主要 SQLite 团队接管并已迁移System.Data.SQLite 下载页面。新的包似乎不再包含混合程序集(包含 sqlite3.dll 和 .NET 包装器的单个程序集)。
新包附带了 .NET DLL 和 SQLite.Interop.dll,根据文档,桌面上不需要这些文件,但我的应用程序无法加载,并显示“无法加载 DLL 'SQLite”。 Interop.DLL':找不到指定的模块。。我尝试在 IIS/IIS Express 下运行该应用程序,并将应用程序池设置为 32 位。
我尝试将 SQLite.Interop.dll 文件复制到 bin 文件夹、系统文件夹和 ASP.NET 临时文件夹中,但仍然出现相同的错误。
是否有任何地方都可以使用新版本的混合程序集?如果没有,是否有办法修复无法加载 DLL 'SQLite.Interop.DLL
错误?
Previously .NET SQLite libraries were available from http://sqlite.phxsoftware.com
, but they have recently been taken over by the main SQLite team and have moved System.Data.SQLite Download Page. The new packages don't seem to contain mixed assemblies anymore (single assembly containing sqlite3.dll and the .NET wrapper).
The new package comes with the .NET DLL and SQLite.Interop.dll
which based on the documentation is not needed on the desktop but my application fails to load with Unable to load DLL 'SQLite.Interop.DLL': The specified module could not be found.
. I have tried running the application under IIS/IIS Express with apppool set to 32-bit.
I have tried copying the SQLite.Interop.dll
file into the bin
folder, the system folder, and the ASP.NET temp folder but still get the same error.
Are there mixed assemblies for new releases available anywhere? If not, is there a way to fix the Unable to load DLL 'SQLite.Interop.DLL
error?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
下载页面现在包含所有版本的“混合模式”下载System.Data.SQLite,其工作方式与早期版本的 SQLite 相同,即无需在项目中包含 SQLite.Interop.dll。
诀窍是 - 在下载链接中查找“bundle”一词,
例如 sqlite-netFx35-setup-bundle-x86-2008-1.0.76.0.exe
您还将看到这些的描述文本链接以“此安装包具有混合模式程序集”开头。
我被烧伤了,因为我没有意识到这实际上意味着“如果你想让它像以前一样工作,就下载这个”。
由于不知道混合模式程序集的含义,其他链接似乎是更好的选择 - 因为它们声称“此安装包将安装所有必要的运行时组件和依赖项”。
另请注意,判断您是否得到“错误”的唯一方法是通过文件大小。这些 DLL 具有完全相同的名称和完全相同的版本号。 混合模式版本要大得多 - 大约 700K。另一张是160K左右。
真是一团乱啊……
The downloads page now contains "mixed mode" downloads for all variations of System.Data.SQLite, that work the same way as earlier versions of SQLite i.e. no requirement to also include SQLite.Interop.dll in your project.
The trick is - look for the word "bundle" in the download links
e.g. sqlite-netFx35-setup-bundle-x86-2008-1.0.76.0.exe
You will also see that the description text for these links begins with "This setup package features the mixed-mode assembly".
I got burned because I didn't realize that this really means "download this one if you want it to work the way it always did before".
Having no idea what was meant by a mixed-mode assembly, the other links seemed like a better option - because they claim "This setup package will install all the necessary runtime components and dependencies".
Also note that the only way to tell if you've gotten the "wrong" one is by file size. The DLLs have exactly the same name, and exactly the same version number. The mixed-mode version is much bigger - around 700K. The other one is around 160K.
What a mess...
我找到了解决方案。该问题是由于 SQLite.Interop 的已知问题造成的.dll。
这是对我有用的解决方法。
I found the solution. The problem was due to a known issue with SQLite.Interop.dll.
This is the workaround from that worked for me.
我在不同应用程序的插件中遇到了同样的问题。就我而言,我通过修改环境变量 PreLoadSQLite_BaseDirectory 在第一次引用 SQLite 之前。
我不明白为什么需要这样做,因为我认为
PreLoadSQLite_BaseDirectory
(嗯,相应的内部变量)将默认为System.Data.SQLite.dll
的位置> 文件。I had the same issue, in a plugin for a different application. In my case I solved it by modifying the environment variable PreLoadSQLite_BaseDirectory before referencing SQLite for the first time.
I don't see why this was required though, as I thought
PreLoadSQLite_BaseDirectory
(well, the corresponding internal variable) would default to the location of theSystem.Data.SQLite.dll
file.在 64 位计算机上,AnyCPU 目标 .NET 应用程序无法加载 32 位 DLL 文件。您可能需要将 .NET 应用程序的平台目标设置为 x86 才能使其在 64 位和 32 位计算机上运行。
编辑:在幕后,您无法加载 Interop DLL 的原因可能是由于与本机 SQLite DLL 文件的位数不匹配而导致
BadImageFormatException
。On 64-bit machines an AnyCPU targeted .NET application cannot load 32-bit DLL files. You likely will need to set the platform target of your .NET application to x86 in order to get it working on both the 64-bit and 32-bit machines.
Edit: under the hood the reason you can't load the Interop DLL is probably because of a
BadImageFormatException
due to the bitness mismatch with the native SQLite DLL file.