System.Data.SQLite DLL找不到当运行一个WPF作为UWP

问题描述 投票:0回答:2

我打算发布我的WPF应用程序到微软商店。所以我遵循这个LINK来包装我的应用程序。

在访问的SQLite数据库,我使用的SQLite由开发团队开发System.Data.SQLite库。

当我执行我的应用程序的WPF一切正常,但是当我执行我的应用程序作为UWP它抛出错误:

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)

我怎样才能解决这个问题?

注:我设法创建数据库文件,但是当我想创建表,上面的错误出现了。

c# wpf sqlite uwp
2个回答
0
投票

尝试从的NuGet引用System.Data.SQLite包:

Install-Package Microsoft.Data.SQLite -Version 2.1.0

或使用Visual Studio的NuGet包管理器UI(右键单击该项目,选择管理的NuGet包解决方案...和搜索Microsoft.Data.SQLite

如果它不能帮助尝试以下的使用本地库预加载部分in the SQLite docs,但我不希望这是必要的。


0
投票

最后,我可以做以下这个thread后,它的工作原理。所有我能做的就是创建x86和x64的2个文件夹,添加SQLite.Interop.dll并将其设置为始终复制。即使你我不知道这是否可以通过分发微软商店。我还需要调查。

© www.soinside.com 2019 - 2024. All rights reserved.