【问题标题】:SQLite on Mono/Ubuntu: DllNotFoundException SQLite.Interop.dllMono/Ubuntu 上的 SQLite:DllNotFoundException SQLite.Interop.dll
【发布时间】:2017-06-11 05:37:25
【问题描述】:

我在 Windows 上开发了一个 SQLite/C# 应用程序,并将其部署在 Ubuntu 服务器上。

我在这里下载了 MONO 的预编译 DLL https://system.data.sqlite.org/downloads/1.0.104.0/sqlite-netFx451-binary-Mono-2013-1.0.104.0.zip

我下载了源代码并使用此脚本编译了 libSQLite.Interop.so,然后将 libSQLite.Interop.so 与其他 DLL 一起移动到网站的 bin 文件夹中 https://system.data.sqlite.org/index.html/artifact?ci=trunk&filename=Setup/compile-interop-assembly-release.sh

它仍然抱怨 System.DllNotFoundException: SQLite.Interop.dll。我尝试将 libSQLite.Interop.so 重命名为 SQLite.Interop.dll,但没有帮助。

我还需要做什么才能让 SQLite(EF6) 在 Ubuntu 上的 MONO 上运行?

【问题讨论】:

标签: c# .net sqlite dll mono


【解决方案1】:

我通过充当 http://blog.wezeku.com/2016/10/09/using-system-data-sqlite-under-linux-and-mono/ 告诉。

您可以克隆源代码,并在特定的 linux-env 中编译。 一条捷径:

Building System.Data.SQLite Interop under Linux
There’s no System.Data.SQLite package for Linux, so you’ll have to build it yourself on your target Linux machine. You can build using this procedure, which is tested in Raspbian Jessie on a Raspberry Pi 3 and Ubuntu 16.04.1 on a PC:

Download System.Data.SQLite full source code from this download page. There’s a ton of files there, and the one you should look for is named something like sqlite-netFx-full-source-<version no>.zip.
Unzip it and transfer it to a directory on your Linux machine. In the rest of this description, I’ll call this directory “<source root>”.
Issue these commands in a Linux terminal:
sudo apt-get update
sudo apt-get install build-essential
cd <source root>/Setup
chmod +x compile-interop-assembly-release.sh
./compile-interop-assembly-release.sh
Now, you will have a freshly built library file called libSQLite.Interop.so in the <source root>/bin/2013/Release/bin directory. This file might have execution permission which isn’t relevant for a library, so remove it by
chmod -x <source root>/bin/2013/Release/bin/libSQLite.Interop.so
Copy libSQLite.Interop.so the directory where your Mono/.NET application’s binaries reside (not the x64 or x86 subdirectories containing SQLite.Interop.dll), and you’re set to go.
And that, ladies and gentlemen, is how we do that!

【讨论】:

    【解决方案2】:

    根本不要使用互操作版本,而是坚持使用您可能已经安装的libmono-sqlite4.0-cil 包。如果 sqlite dll 与您的应用程序一起部署,请将其删除,以便系统从 GAC 获取打包版本。

    【讨论】:

    • 我认为该版本不支持 Entity Framework 6
    猜你喜欢
    • 2015-09-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多