无法在SQLite Net Platform WinRT中加载DLL的’sqlite3′
我正在使用Xamarin.Forms开发本机应用程序。 但我现在面临的问题与Xamarin无关。 我添加了新的Windows Phone项目
right-click > Add > New Project -> Windows Phone Apps -> Blank App(Windows Phone).
在我在Visual Studio premium 2013中的现有Xamarin项目中。我使用sqlitenet pcl进行数据库连接。 我的项目中有以下代码。
public ISQLitePlatform CreateSqlitePlatformInterface() { return new SQLitePlatformWinRT(); }
当它在行上面执行时,它会抛出exception
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
以上是我从Nuget下载的软件包。 我错过了什么吗? 我还需要添加什么?
我也尝试过:
- 从Sqlite下载页面下载sqlite-winrt81-3081002.vsix 。
- 从x86复制sqlite3.dll。
- 尝试将其粘贴到我的bin文件夹以及我的项目根目录中 ,并将其内容更改为始终复制。 ( 参考:https://stackoverflow.com/questions/4744293/unable-to-load-dll-sqlite3-the-specified-module-could-not-be-found-exceptio )
- 我的项目是针对x86而不是任何CPU 。
尝试了来自Sol1 , Sol2的建议解决方案
我的项目参考:
安装SQLite Visual Studio扩展后,需要在Windows / Extensions下的Reference Manager中添加对SQLite for Windows Runtime
引用。
像这样。
在2016年3月更新到Windows 10和Visual Studio 2015之后,我遇到了这种错误的不同风格:我的应用程序在部署到我的桌面时运行正常,但在使用System.DllNotFoundException(“无法加载DLL的sqlite3”时)时崩溃了部署到我的平板电脑(即使在使用最新更新更新平板电脑操作系统后)。所以我解决问题的步骤如下:
- 卸载名为“SQLite for Universal App Platform”的VS扩展(v3.10.2)
- 从我的项目中删除了对此扩展的引用
- 再次安装扩展 – 除了这次它在在线扩展列表中显示为“SQLite for Universal Windows Platform”(v3.12.1)
- 在我的项目中添加了对此扩展的引用
- (这是我之前不需要做的重要部分):添加了对“Visual C ++ 2015 Runtime for Universal Windows Platform Apps”(v14.0)扩展的引用
直到最后一步它才真正解决了问题。