Unable to load DLL 'sqlite3' - for Windows Universal Mobile

*爱你&永不变心* 提交于 2019-12-06 08:53:06

问题


I used Visual Studio 2015 with SP2. I try created Windows Universal app with sqlite. I added SQLite for Unversal Windows Platforms and SQLite.Net-PCl. It is my simple code

var conn = new SQLiteConnection(
            new SQLitePlatformWinRT(),
            Path.Combine(ApplicationData.Current.LocalFolder.Path,  "Storage.sqlite"));

It is working for desktop. But it is not work for mobile(in device and emulator). I get this exception 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()

I try this method. I reinstall SQLite for Unversal Windows Platforms extension and SQLite.Net-PCl. I created clear project. But it does not work for me.


回答1:


I add a reference to Visual C++ 2015 Runtime for Universal Windows Platform Apps. It is work for me. I used SQLite for Universal Windows Platform.




回答2:


Make sure that you current add 2 references

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

It's still worked!




回答3:


Solved in chat.
OP solved it using Nuget console : Install-Package SQLite.WinRT.UAP and used "add link" ->"Extensions"->SQLite for Windows Runtime
Suggestion
Cool but would suggest you to use Extension SQLite for Universal App Platform as it encases most of device family and SQLite.WinRT.UAP is not needed. As in current repo I removed references for Winrt and using these extensions its working fine. Just check if the Sqlite vsix package installed is the correct one on your system.



来源:https://stackoverflow.com/questions/36350816/unable-to-load-dll-sqlite3-for-windows-universal-mobile

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!