sqllite3.dll 移动版 UWP 应用开发问题
sqllite3.dll issues with UWP app development for Mobile
我正在尝试学习如何为桌面和移动设备开发 UWP 应用程序。我目前一直致力于让 Entity Framework 在我的应用程序中工作以存储应用程序状态并遵循以下 link:
https://docs.microsoft.com/en-us/ef/core/get-started/uwp/getting-started
它在桌面上运行良好,但问题是当我尝试在 Windows 移动模拟器上 运行 它时,当代码到达 db.Database.Migrate() 步骤:
Unable to load DLL 'sqlite3': The specified module could not be found
在我上面粘贴的 link 中,其他人遇到了同样的问题,他们在评论中建议尝试以下操作:
Step 1: Install SQLite VSIX pacakge for Universal Windows Platform development using Visual Studio 2015
https://www.sqlite.org/2016/sqlite-uwp-3130000.vsix
Step 2: Install NuGet package SQLite.NET-PCL
Install-Package SQLite.NET-PCL
Step 3: Add references
Add Reference -> Universal Windows ->Extensions -> Make sure the following packages have been checked: "SQLite for Universal Windows Platform" "Visual C++ 2015 Runtime for Universal Windows Platform Apps"
After that, if you get the error "Payload contains two or more files with the same destination path 'sqlite3.dll', do the following:
copy sqlite3.dll from
C:\Program Files (x86)\Microsoft SDKs\UAP\v0.8.0.0\ExtensionSDKs\SQLite.UAP.2015.8.11.1\Redist\Debug\ARM\sqlite3.dll
past to (override it)
C:\Users\%USERNAME%\.nuget\packages\SQLitePCL.raw_basic[=12=].7.1\build\native\sqlite3_dynamic\winrt81\arm\sqlite3.dll
执行这些步骤后的问题是,我现在在为 "Payload contains two or more files" 构建时看到问题,但不在 SQLitePCL.raw_basic 目录中(我什至似乎没有那个) .相反,我的错误如下:
Payload contains two or more files with the same destination path 'sqlite3.dll'. Source files:
C:\Users\admin\.nuget\packages\SQLite.13.0\runtimes\win7-x86\native\sqlite3.dll
C:\Program Files (x86)\Microsoft SDKs\UAP\v0.8.0.0\ExtensionSDKs\SQLite.UWP.2015.13.0\Redist\Debug\x86\sqlite3.dll
我一直在到处搜索,对于如何让我的 UWP 程序在移动设备上运行真的很困惑。非常感谢您的帮助!
您似乎从@Leandro_Medeiros_Machado 对 this document 的评论中找到了解决异常 The specified module could not be found
的解决方案。如果您在完成上述三个步骤后遇到 Payload contains two or more files with the same destination path 'sqlite3.dll'
异常,您可能还会从评论中找到下一个解决方案。
After that, if you get the error "Payload contains two or more files with the same destination path 'sqlite3.dll', do the following:copy sqlite3.dll from
C:\Program Files (x86)\Microsoft SDKs\UAP\v0.8.0.0\ExtensionSDKs\SQLite.UAP.2015.8.11.1\Redist\Debug\ARM\sqlite3.dll
past to (override it)
C:\Users\%USERNAME%\.nuget\packages\SQLitePCL.raw_basic[=13=].7.1\build\native\sqlite3_dynamic\winrt81\arm\sqlite3.dll
对于您来说,您可能需要从
C:\Program Files (x86)\Microsoft SDKs\UAP\v0.8.0.0\ExtensionSDKs\SQLite.UWP.2015.13.0\Redist\Debug\x86\sqlite3.dll
到(覆盖)C:\Users\admin\.nuget\packages\SQLite.13.0\runtimes\win7-x86\native\sqlite3.dll
.
但实际上,对于使用 EF 核心,您不需要上述步骤,我建议您检查您的环境,而不是使用上述解决方法。我按照文档创建了一个简单的 EF 项目,无需安装 VSIX,我可以 运行 在模拟器(内部版本 10586)上成功。我的 VS 构建是 2015 更新 3,我的 OS 版本是构建 14393,EF 核心版本是 Microsoft.EntityFrameworkCore.Sqlite 1.1.0
。所以请首先检查您的环境是否满足以下要求:
Windows 10
Visual Studio 2015 更新 3
并且如果您的 EF 核心和 EF 核心工具版本正确。
我正在尝试学习如何为桌面和移动设备开发 UWP 应用程序。我目前一直致力于让 Entity Framework 在我的应用程序中工作以存储应用程序状态并遵循以下 link:
https://docs.microsoft.com/en-us/ef/core/get-started/uwp/getting-started
它在桌面上运行良好,但问题是当我尝试在 Windows 移动模拟器上 运行 它时,当代码到达 db.Database.Migrate() 步骤:
Unable to load DLL 'sqlite3': The specified module could not be found
在我上面粘贴的 link 中,其他人遇到了同样的问题,他们在评论中建议尝试以下操作:
Step 1: Install SQLite VSIX pacakge for Universal Windows Platform development using Visual Studio 2015
https://www.sqlite.org/2016/sqlite-uwp-3130000.vsix
Step 2: Install NuGet package SQLite.NET-PCL
Install-Package SQLite.NET-PCL
Step 3: Add references
Add Reference -> Universal Windows ->Extensions -> Make sure the following packages have been checked: "SQLite for Universal Windows Platform" "Visual C++ 2015 Runtime for Universal Windows Platform Apps"
After that, if you get the error "Payload contains two or more files with the same destination path 'sqlite3.dll', do the following:
copy sqlite3.dll from
C:\Program Files (x86)\Microsoft SDKs\UAP\v0.8.0.0\ExtensionSDKs\SQLite.UAP.2015.8.11.1\Redist\Debug\ARM\sqlite3.dll
past to (override it)
C:\Users\%USERNAME%\.nuget\packages\SQLitePCL.raw_basic[=12=].7.1\build\native\sqlite3_dynamic\winrt81\arm\sqlite3.dll
执行这些步骤后的问题是,我现在在为 "Payload contains two or more files" 构建时看到问题,但不在 SQLitePCL.raw_basic 目录中(我什至似乎没有那个) .相反,我的错误如下:
Payload contains two or more files with the same destination path 'sqlite3.dll'. Source files:
C:\Users\admin\.nuget\packages\SQLite.13.0\runtimes\win7-x86\native\sqlite3.dll
C:\Program Files (x86)\Microsoft SDKs\UAP\v0.8.0.0\ExtensionSDKs\SQLite.UWP.2015.13.0\Redist\Debug\x86\sqlite3.dll
我一直在到处搜索,对于如何让我的 UWP 程序在移动设备上运行真的很困惑。非常感谢您的帮助!
您似乎从@Leandro_Medeiros_Machado 对 this document 的评论中找到了解决异常 The specified module could not be found
的解决方案。如果您在完成上述三个步骤后遇到 Payload contains two or more files with the same destination path 'sqlite3.dll'
异常,您可能还会从评论中找到下一个解决方案。
After that, if you get the error "Payload contains two or more files with the same destination path 'sqlite3.dll', do the following:copy sqlite3.dll from
C:\Program Files (x86)\Microsoft SDKs\UAP\v0.8.0.0\ExtensionSDKs\SQLite.UAP.2015.8.11.1\Redist\Debug\ARM\sqlite3.dll
past to (override it)C:\Users\%USERNAME%\.nuget\packages\SQLitePCL.raw_basic[=13=].7.1\build\native\sqlite3_dynamic\winrt81\arm\sqlite3.dll
对于您来说,您可能需要从
C:\Program Files (x86)\Microsoft SDKs\UAP\v0.8.0.0\ExtensionSDKs\SQLite.UWP.2015.13.0\Redist\Debug\x86\sqlite3.dll
到(覆盖)C:\Users\admin\.nuget\packages\SQLite.13.0\runtimes\win7-x86\native\sqlite3.dll
.
但实际上,对于使用 EF 核心,您不需要上述步骤,我建议您检查您的环境,而不是使用上述解决方法。我按照文档创建了一个简单的 EF 项目,无需安装 VSIX,我可以 运行 在模拟器(内部版本 10586)上成功。我的 VS 构建是 2015 更新 3,我的 OS 版本是构建 14393,EF 核心版本是 Microsoft.EntityFrameworkCore.Sqlite 1.1.0
。所以请首先检查您的环境是否满足以下要求:
Windows 10
Visual Studio 2015 更新 3
并且如果您的 EF 核心和 EF 核心工具版本正确。