无法在移动设备上运行的通用 Windows 应用程序中加载 DLL sqlite3 [英] Unable to load DLL sqlite3 in Universal Windows App running on Mobile
问题描述
我正在开发 UWP.我正在使用 sqlite-net-pcl 库.将我的应用程序从 RC 升级到 RTM 后,出现运行时错误 - 找不到 sqlite3.dll - 如果它在移动模拟器或设备上运行.在我添加对 C++ 2013 运行时包的引用并在本地机器中运行后,它运行良好.
I am developing a UWP. I am using the sqlite-net-pcl library. After upgrading my Application from RC to RTM , I got a runtime error - sqlite3.dll could not be found - if it runs on a Mobile emulator or a device. It worked prefectly after I added a reference to C++ 2013 Runtime Package and I ran it in Local Machine.
异常信息:
消息'SQLitePCL.raw' 的类型初始值设定项抛出了一个异常."字符串
Message "The type initializer for 'SQLitePCL.raw' threw an exception." string
内部异常消息:
{"无法加载 DLL 'sqlite3': 指定的模块不能发现.(来自 HRESULT 的异常:0x8007007E)"} System.Exception{System.DllNotFoundException}
{"Unable to load DLL 'sqlite3': The specified module could not be found. (Exception from HRESULT: 0x8007007E)"} System.Exception {System.DllNotFoundException}
当然,我无法向通用应用程序平台的 Sqlite"添加引用,因为我收到以下错误
Of course I could not add a referece to 'Sqlite for Universal App Platform' because I am geting the following error
严重性代码描述项目文件行错误有效负载包含具有相同目标路径sqlite3.dll"的两个或更多文件.来源文件:C:\Program Files (x86)\MicrosoftSDKs\UAP\v0.8.0.0\ExtensionSDKs\SQLite.UAP.2015\3.8.11.1\Redist\Debug\ARM\sqlite3.dllC:\Users\sMavrikis.nuget\packages\SQLitePCL.raw_basic\0.7.1\build\native\sqlite3_dynamic\winrt81\arm\sqlite3.dll TestApp1
Severity Code Description Project File Line Error Payload contains two or more files with the same destination path 'sqlite3.dll'. Source files: C:\Program Files (x86)\Microsoft SDKs\UAP\v0.8.0.0\ExtensionSDKs\SQLite.UAP.2015\3.8.11.1\Redist\Debug\ARM\sqlite3.dll C:\Users\sMavrikis.nuget\packages\SQLitePCL.raw_basic\0.7.1\build\native\sqlite3_dynamic\winrt81\arm\sqlite3.dll TestApp1
推荐答案
添加对SQLite for Universal App Platform"的引用这将触发错误:
Add a reference to 'SQLite for Universal App Platform' This will trigger the error:
Payload 包含两个或多个具有相同目标路径sqlite3.dll"的文件.
Payload contains two or more files with the same destination path 'sqlite3.dll'.
出现此错误的原因是错误标记的两个位置的 sqlite3.dll 版本不同.只需复制即可解决此错误
This error occurs because of different version of sqlite3.dll in both the locations marked by the error. Resolve this error by simply copying
C:\Program Files (x86)\Microsoft SDKs\UAP\v0.8.0.0\ExtensionSDKs\SQLite.UAP.2015\3.8.11.1\Redist\Debug\ARM\sqlite3.dll
C:\Program Files (x86)\Microsoft SDKs\UAP\v0.8.0.0\ExtensionSDKs\SQLite.UAP.2015\3.8.11.1\Redist\Debug\ARM\sqlite3.dll
到
C:\Users\%USERNAME%\.nuget\packages\SQLitePCL.raw_basic\0.7.1\build\native\sqlite3_dynamic\winrt81\arm\sqlite3.dll
C:\Users\%USERNAME%\.nuget\packages\SQLitePCL.raw_basic\0.7.1\build\native\sqlite3_dynamic\winrt81\arm\sqlite3.dll
覆盖现有文件.
重建您的项目.现在应该可以编译了.
Rebuild your project. It should compile now.
这篇关于无法在移动设备上运行的通用 Windows 应用程序中加载 DLL sqlite3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!