无法加载DLL的'sqlite3' - 适用于Windows Universal Mobile

Fet*_*mos 3 sqlite windows-phone sqlite-net win-universal-app visual-studio-2015

我使用Visual Studio 2015 SP2.我尝试使用sqlite创建Windows Universal应用程序.我为Unversal Windows平台和SQLite.Net-PCl添加了SQLite.这是我简单的代码

var conn = new SQLiteConnection(
            new SQLitePlatformWinRT(),
            Path.Combine(ApplicationData.Current.LocalFolder.Path,  "Storage.sqlite"));
Run Code Online (Sandbox Code Playgroud)

它适用于桌面.但它不适用于移动设备(在设备和模拟器中).我得到这个异常System.DllNotFoundException:

  HResult=-2146233052
  Message=Unable to load DLL 'sqlite3': The specified module could not be  found. (Exception from HRESULT: 0x8007007E)
Source=SQLite.Net.Platform.WinRT
TypeName=""
StackTrace:
   at SQLite.Net.Platform.WinRT.SQLite3.SetDirectory(UInt32 directoryType, String directoryPath)
   at SQLite.Net.Platform.WinRT.SQLiteApiWinRT..ctor()
   at SQLite.Net.Platform.WinRT.SQLitePlatformWinRT..ctor()
   at AppDbTest.MainPage.DbConnection()
   at AppDbTest.MainPage..ctor()
   at AppDbTest.AppDbTest_XamlTypeInfo.XamlTypeInfoProvider.Activate_0_MainPage()
   at AppDbTest.AppDbTest_XamlTypeInfo.XamlUserType.ActivateInstance()
Run Code Online (Sandbox Code Playgroud)

我尝试这种方法.我重新安装SQLite for Unversal Windows Platforms扩展和SQLite.Net-PCl.我创建了明确的项目.但它对我不起作用.

Fet*_*mos 10

我添加了对通用Windows平台应用程序的Visual C++ 2015 Runtime的引用.这对我有用.我使用SQLite作为通用Windows平台.


小智 5

确保您当前添加2个引用

  1. Sqlite for Universal Windows Platfrom
  2. 用于Unversal Windows Platfrom的Visual C++ Runtime 2015

它仍然有效!