c# - 无法在 SQLite Net Platform WinRT 中加载 DLL 'sqlite3'

标签 c# sqlite windows-runtime

我正在使用 Xamarin.Forms 开发 native 应用程序。但是我现在面临的问题与Xamarin无关。我通过

添加了新的 Windows Phone 项目

右键单击 > 添加 > 新建项目 -> Windows Phone 应用程序 -> 空白应用程序(Windows Phone)。

在 Visual Studio premium 2013 中我现有的 Xamarin 项目中。我正在使用 sqlitenet pcl 进行数据库连接。我的项目中有以下代码。

public ISQLitePlatform CreateSqlitePlatformInterface()
        {
            return new SQLitePlatformWinRT();
        }

当它在上面执行时,它会抛出异常

An exception of type 'System.DllNotFoundException' occurred in SQLite.Net.Platform.WinRT.DLL but was not handled in user code

Additional information: Unable to load DLL 'sqlite3': The specified module could not be found. (Exception from HRESULT: 0x8007007E)

这个问题已经被问过很多次了,我尝试了所有建议的解决方案,但我仍然无法修复它。

我的 Packages.config

 <package id="SQLite.Net-PCL" version="3.0.5" targetFramework="wpa81" />
  <package id="Sqlite-Winrt" version="3.8.7.1" targetFramework="wpa81" />
  <package id="Xamarin.Forms" version="1.4.2.6359" targetFramework="wpa81" />

以上是我从Nuget下载的包。我错过了什么吗?我还需要添加什么?

我也试过:

  1. Sqlite 下载 sqlite-winrt81-3081002.vsix下载 页面。
  2. 从 x86 复制了 sqlite3.dll。
  3. 尝试将其粘贴到我的bin 文件夹以及我的项目 root 并将其内容更改为 总是复制。 ( ref: https://stackoverflow.com/questions/4744293/unable-to-load-dll-sqlite3-the-specified-module-could-not-be-found-exceptio )
  4. 我的项目针对 x86 而不是任何 CPU

尝试了以下建议的解决方案:Sol1 , Sol2

我的项目引用:

enter image description here

最佳答案

安装 SQLite Visual Studio Extension 后,您需要在 Windows/Extensions 下的 Reference Manager 中添加对 SQLite for Windows Runtime 的引用。

Like this.

关于c# - 无法在 SQLite Net Platform WinRT 中加载 DLL 'sqlite3',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31042772/

相关文章:

c++ - 使用 C++/WinRT 制作一个简单的消息框

windows-runtime - 获取当前用户的 WinRT 唯一 ID

c# - 我应该使用 ReAllocHGlobal 还是 FreeHGlobal/AllocHGlobal?

Sqlite 查询 - 测试数据库设定区域中是否存在多个值

c# - 非阻塞并发收集?

c++ - 如何使用 sqlite3_step 迭代 sqlite3 中的行?

sqlite - ORMLite查询日期格式问题

c# - 在 WinRT 中下载网页引发异常

c# - 是否可以像字典一样将枚举与对值一起使用

c# - 如何将错误和其他消息从 DAL/业务层向上传递到 UI 层?