c# - 将 WPF 作为 UWP 运行时未找到 System.Data.SQLite dll
问题描述
我计划将我的 WPF 应用程序发布到 Microsoft Store。所以我按照这个链接来打包我的应用程序。
在访问SQLite db 时,我使用的是 SQLite Dev 团队开发的System.Data.SQLite lib。
当我将我的应用程序作为 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)
我怎样才能解决这个问题?
注意:我设法创建了 db 文件,但是当我想创建 teble 时,出现了上述错误。
解决方案
尝试System.Data.SQLite
从 NuGet 引用包:
Install-Package Microsoft.Data.SQLite -Version 2.1.0
或者在 Visual Studio 中使用NuGet 包管理器 UI(右键单击项目,选择Manage NuGet Packages for Solution...并搜索Microsoft.Data.SQLite
.
如果它没有帮助,请尝试遵循SQLite 文档中的Using Native Library Preloading部分,尽管我不认为这是必要的。
推荐阅读
- javascript - 简单的获取请求
- regex - scala正则表达式实现
- .htaccess - 任何人都可以为 CodeIgniter 的网站建议 307 重定向问题吗?
- java - 如何在opencv java中的图像或视频中间画一条线
- apache-kafka - 如何检查 kafka 机器上损坏/坏的文件
- java - Java Google Sheets API v4:如何获取实际的行数和列数
- javascript - 仅当在 Django 中使用 JavaScript 单击相应的左/右箭头时才激活特定的“图像滑块”
- python - Keras 不使用 GPU - 如何排除故障?
- python - 释放鼠标后在python中调用一个函数并在从中选择一个选项后关闭tkinter窗口
- postgresql - 如何使postgresql只在日志中记录DDL语句?