无法加载DLL文件'sqlite3.dll': 在UWP Xamarin.Forms中未找到指定的模块

3
我正在尝试使用Azure Mobile SQLiteStore包编写UWP Xamarin.Forms应用程序。但我遇到了该软件包的依赖项SQLitePCL的问题。
在我的UWP项目中,我引用了适用于通用Windows平台的SQLite扩展,以及它的依赖项Microsoft.VCLibs。 错误信息是:无法加载DLL“sqlite3.dll”:找不到指定的模块。(来自HRESULT的异常:0x8007007E)
安卓应用程序运行良好,只有UWP出现问题,一旦开始调用SQLite就会崩溃。
以下是堆栈跟踪信息:
at SQLitePCL.SQLiteConnection.SetTemporaryDirectory()
at SQLitePCL.SQLiteConnection..ctor(String fileName, SQLiteOpen openFlag, Boolean setTemporaryDirectory)
at Microsoft.WindowsAzure.MobileServices.SQLiteStore.MobileServiceSQLiteStore..ctor(String fileName)
at WellDoneIt.Services.WellDoneItMobileService.d__7.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
at WellDoneIt.Services.WellDoneItMobileService.d__8.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at WellDoneIt.ViewModel.ListViewModel.d__4.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
at WellDoneIt.ViewModel.ListViewModel.<<-ctor>b__2_2>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.<>c.b__6_0(Object state)
at System.Threading.WinRTSynchronizationContext.Invoker.InvokeCore()

有人知道如何解决这个问题吗?

更新:我还仔细检查了处理器架构,模拟器设置为x86,真实的Win10移动设备设置为ARM。

在两者上都遇到了完全相同的问题。但是当我在本地机器上运行我的应用程序(我开发Windows 10操作系统的机器)时,一切正常。

提前致谢。


请确保在构建输出中不使用“任何CPU”。它应该是x86或ARM,具体取决于您正在运行的内容。 - lindydonna
搞定了。在 UWP 项目中,模拟器 x86 和真实设备 ARM 都可以使用。对于 PCL DLL,我选择了 AnyCPU,我认为这是正确的设置。感谢您的评论。 - hal9k2
2个回答

5

您需要为Windows平台添加SQLite引用。

在您的UWP项目中,前往“添加引用”。

进入“通用 Windows > 扩展”。

然后确保选中“Universal App Platform的SQLite”。


感谢您的回答。我知道这个扩展是为UWP和Windows 8应用程序设计的。我已经获取了最新版本,包括VC++依赖项,并将它们都引用到我的项目中,但出现了某些错误。 - hal9k2

1
我已经为了同样的问题苦苦挣扎了几个小时。
我将SQLite升级到最新版本,我认为这就是问题开始的地方。
我下载了Visual Studio 2015 Update 2,运行并选择修改。然后确保所有突出显示的更新都被选中,而废弃的项目则未被选中。(Update 2已包含在最新的社区下载中)
希望这对你有用。

你的回答意思是下载最新的VS2015社区版吗?如果是的话,我必须告诉你,我的问题是在系统重新安装和几天前下载了VS2015 Update 2之后开始出现的。以前,我在旧的Windows安装上使用较旧但不断更新的VS2015社区版进行开发,一切都正常。当我需要重新安装系统(由于其他问题)时,我从Web上安装了最新的VS2015 Update 2,带有Xamarin所需的工具,并进行了所有必要的更新。然后这个问题就出现了...谢谢你的回答。 - hal9k2
1
我的问题可能不同,另外提供给您的信息是,SQLite网站上似乎存在与此相关的问题,但没有提供解决方案。祝你好运。 - 27k1
你能否在这里分享链接,我在那里找不到任何相关信息。谢谢。 - hal9k2
抱歉,现在找不到它。 顺便提一下,我正在使用的是SQLite.UWP.2015,版本为3.12.1和Visual C++ 2015 Runtime for Universal Windows Platform Apps。 - 27k1

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接