System.Data.SQLite dll Not Found When Running a WPF as an UWP

0

I'm planning to publish my WPF application to Microsoft Store. So I follow this LINK to package my app.

In accessing SQLite db, I'm using System.Data.SQLite lib developed by SQLite Dev team.

When I execute my app as WPF everything normal, but when I execute my app as UWP it throws error:

System.DllNotFoundException: Unable to load DLL 'SQLite.Interop.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
at System.Data.SQLite.UnsafeNativeMethods.sqlite3_config_none(SQLiteConfigOpsEnum op)
at System.Data.SQLite.SQLite3.StaticIsInitialized()
at System.Data.SQLite.SQLiteLog.Initialize(String className)
at System.Data.SQLite.SQLiteConnection..ctor(String connectionString, Boolean parseViaFramework)
at System.Data.SQLite.SQLiteConnection..ctor(String connectionString)
at eComEasy.Lib.Helper.LibUtility.InitiateDbSchema(String connString, String[] names)

How can I fix this?

Note: I manage to create the db file, but when I wanna create teble, the above error came up.

c#
wpf
sqlite
uwp
asked on Stack Overflow Nov 20, 2018 by Bromo Programmer • edited Nov 20, 2018 by Bromo Programmer

2 Answers

0

Try to reference the System.Data.SQLite package from NuGet:

Install-Package Microsoft.Data.SQLite -Version 2.1.0

Or using NuGet Package Manager UI in Visual Studio (right-click the project, choose Manage NuGet Packages for Solution... and search for Microsoft.Data.SQLite.

In case it does not help try following the Using Native Library Preloading section in the SQLite docs, although I wouldn't expect that to be necessary.

answered on Stack Overflow Nov 20, 2018 by Martin Zikmund
0

At last, I can make it works after following this thread. Where all I can do is create 2 folders of x86 and x64, add SQLite.Interop.dll and set it to Copy Always. Even thou I'm not sure whether this can be distributes through Microsoft Store. I still need to investigate.

answered on Stack Overflow Nov 20, 2018 by Bromo Programmer

User contributions licensed under CC BY-SA 3.0