I am in process of developing native app using Xamarin.Forms. But the problem I am facing now is not related with Xamarin. I added new Windows Phone project by
right-click > Add > New Project -> Windows Phone Apps -> Blank App(Windows Phone).
in my existing Xamarin project in Visual Studio premium 2013. I am using sqlitenet pcl for database connection. I have below code in my project.
public ISQLitePlatform CreateSqlitePlatformInterface()
{
return new SQLitePlatformWinRT();
}
When it executes above line, it throws exception as
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)
This has been asked many many times and I tried all suggested solution, still I am not able to fix it.
My 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" />
Above are the packages I downloaded from Nuget. Am I missing anything? What else I need to add?
Also I tried:
- Downloaded sqlite-winrt81-3081002.vsix from Sqlite download page.
- Copied sqlite3.dll from x86.
- Tried pasting it in my bin folder as well as in my project root and changed it content to copy always. (ref: https://stackoverflow.com/questions/4744293/unable-to-load-dll-sqlite3-the-specified-module-could-not-be-found-exceptio)
- My project is targeting x86 not Any CPU.
Tried suggested solution from: Sol1, Sol2
My Project References:
I experienced a different flavour of this error after some March 2016 updates to Windows 10 and Visual Studio 2015: my app would run fine when deployed to my desktop but crash with the System.DllNotFoundException (“Unable to load DLL 'sqlite3'") when deployed to my tablet (even after updating the tablets OS with the latest updates). So my steps to resolve the problem were as follows:
It wasn't until that last step that it actually fixed the problem.
After installing the SQLite Visual Studio Extension, you need to add a reference To the
SQLite for Windows Runtime
In Reference Manager under Windows / Extensions.Like this.