M.R*_*dha 6 sqlite entity-framework-core windows-10-mobile uwp uwp-xaml
我正在尝试使用UWP编写一个简单的手机应用程序,它将Windows文件夹位置的图像插入SQLite上的表格并在Windows手机上查看.
我在technet论坛上发现这篇文章,我用它作为参考:
按照说明操作时,我遇到了安装软件包Microsoft.EntityFrameworkCore.Tools(最新的稳定版本2.0.1)的问题:
PM> Install-Package Microsoft.EntityFrameworkCore.Tools
GET https://api.nuget.org/v3/registration3-gz/microsoft.entityframeworkcore.tools/index.json
OK https://api.nuget.org/v3/registration3-gz/microsoft.entityframeworkcore.tools/index.json 74ms
Restoring packages for c:\users\intui\documents\visual studio 2017\Projects\PicturesApp\PicturesApp\PicturesApp.csproj...
Install-Package : Package Microsoft.EntityFrameworkCore.Tools 2.0.1 is not compatible with uap10.0.10586 (UAP,Version=v10.0.10586). Package
Microsoft.EntityFrameworkCore.Tools 2.0.1 supports: netstandard2.0 (.NETStandard,Version=v2.0)
At line:1 char:2
+ Install-Package Microsoft.EntityFrameworkCore.Tools
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Install-Package], Exception
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand
Run Code Online (Sandbox Code Playgroud)
以前的版本(2.0.0)也出现了同样的问题,但是下一个以前的版本(1.1.4)已成功安装.
但是,我发现代码"PictureAppContext"类中使用的"DbContextOptionsBuilder"类无法识别方法"UseSqlite":
Severity Code Description Project File Line Suppression State Error CS1061 'DbContextOptionsBuilder' does not contain a definition for 'UseSqlite' and no extension method 'UseSqlite' accepting a first argument of type "DbContextOptionsBuilder' could be found (are you missing a using directive or an assembly reference?) PicturesApp c:\users\intui\documents\visual studio 2017\Projects\PicturesApp\PicturesApp\PictureAppContext.cs 16 Active
Run Code Online (Sandbox Code Playgroud)
谁知道如何解决这个问题?
谢谢!
Oge*_*ike 10
我使用dotnet sdk 2.1.1遇到了同样的问题,它应该包含所有基本依赖项Microsoft.AspnetCore.App.我需要做的就是dotnet add package Microsoft.EntityFrameworkCore.Sqlite在项目目录的终端窗口中运行(包含Program.cs,Startup.cs和.csproj文件的目录)