【发布时间】:2016-07-31 00:44:54
【问题描述】:
我正在尝试使用 Azure Mobile SQLiteStore 包为 UWP Xamarin.Forms 编写应用程序。
我在使用 SQLitePCL 包,它是上述包的依赖项。
在我的 UWP 项目中,我引用了通用 Windows 平台的扩展 SQLite,它也是 Microsoft.VCLibs 的依赖项
错误是:无法加载 DLL 'sqlite3.dll':找不到指定的模块。 (HRESULT 异常:0x8007007E)
Android 应用运行正常,只有 UWP 有这个问题,应用一开始调用 SQLite 就会崩溃。
还有 Stacktrace:
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,具体取决于您正在运行的设备。
-
整理好了。对于模拟器 x86 和真实设备 ARM,在 UWP 项目中。对于 PCL DLL,我得到了 AnyCPU,我认为这是正确的设置。感谢您的评论。
标签: sqlite azure win-universal-app xamarin.forms azure-mobile-services