[英]Stuck in asp.net core tutorial. Trying to use package manager console to add EF Core SQL Server provider does not work
I am following this beginners tutorial on Microsoft's site.我正在关注微软网站上的这个初学者教程。
At this step...在这一步...
In the PMC, run the following command:
Install-Package Microsoft.EntityFrameworkCore.SqlServer
When I enter that command I get these messages and errors..当我输入该命令时,我收到这些消息和错误..
PM> Install-Package Microsoft.EntityFrameworkCore.SqlServer
Restoring packages for C:\projects\LazerbaseASPNET\LazerbaseASPNET\LazerbaseASPNET.csproj...
GET https://api.nuget.org/v3-flatcontainer/microsoft.entityframeworkcore.sqlserver/index.json
OK https://api.nuget.org/v3-flatcontainer/microsoft.entityframeworkcore.sqlserver/index.json 208ms
GET https://api.nuget.org/v3-flatcontainer/microsoft.entityframeworkcore.sqlserver/6.0.7/microsoft.entityframeworkcore.sqlserver.6.0.7.nupkg
OK https://api.nuget.org/v3-flatcontainer/microsoft.entityframeworkcore.sqlserver/6.0.7/microsoft.entityframeworkcore.sqlserver.6.0.7.nupkg 71ms
Installed Microsoft.EntityFrameworkCore.SqlServer 6.0.7 from https://api.nuget.org/v3/index.json with content hash D9YV3hc3VSN1qrfdrZcKtMcRLT6bUqj8KtaUdkmO1CH/+meL+8z3Rge5iPhwQ4ol2AwPQlQYVPTTajf9ulSFGg==.
Install-Package : NU1202: Package Microsoft.EntityFrameworkCore.SqlServer 6.0.7 is not compatible with netcoreapp3.1 (.NETCoreApp,Version=v3.1). Package
Microsoft.EntityFrameworkCore.SqlServer 6.0.7 supports: net6.0 (.NETCoreApp,Version=v6.0)
At line:1 char:1
+ Install-Package Microsoft.EntityFrameworkCore.SqlServer
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Install-Package], Exception
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand
Install-Package : Package restore failed. Rolling back package changes for 'LazerbaseASPNET'.
At line:1 char:1
+ Install-Package Microsoft.EntityFrameworkCore.SqlServer
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Install-Package], Exception
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand
Time Elapsed: 00:00:03.2286177
Seems the important one is this...看来重要的是这个……
Package Microsoft.EntityFrameworkCore.SqlServer 6.0.7 is not compatible with netcoreapp3.1 (.NETCoreApp,Version=v3.1). Package
Microsoft.EntityFrameworkCore.SqlServer 6.0.7 supports: net6.0
This tutorial is for asp.net core 3.1.. It seems to be the one they recommend for beginners also.本教程适用于asp.net 内核 3.1.. 这似乎也是他们推荐给初学者的教程。 I am at a impass and have no idea how to proceed.
我陷入了僵局,不知道如何进行。
EDIT: I think this is cus I used Visual Studio 2019 which I already had installed for Unity.. asp.net core 3.1 was the only option available for a new project... I think I need to wipe the existing server from azure, download Visual Studio 2022 and start again with a asp.net core 6 app?编辑:我认为这是因为我使用了我已经为 Unity 安装的 Visual Studio 2019。asp.net 核心 3.1 是新项目可用的唯一选项...我想我需要从 azure 中擦除现有服务器,下载 Visual Studio 2022 并从 asp.net 内核 6 应用程序重新开始?
You can try to install entity framework core through the nuget package manager.您可以尝试通过 nuget package 管理器安装实体框架核心。 Rightclick on your project -> Manage Nuget packages.
右键单击您的项目 -> 管理 Nuget 包。 Before installing select the correct version from the dropdown for the netcore app version you are running.
在安装 select 之前,请从您正在运行的 netcore 应用程序版本的下拉列表中选择正确的版本。
I think this is cus I used Visual Studio 2019 which I already had installed for Unity.. asp.net core 3.1 was the only option available for a new project.我认为这是因为我使用了已为 Unity 安装的 Visual Studio 2019。asp.net 核心 3.1 是新项目可用的唯一选项。 The solution is wipe the existing server from azure, download Visual Studio 2022 and start again with a asp.net core 6 app.
解决方案是从 azure 中擦除现有服务器,下载 Visual Studio 2022 并使用 asp.net 核心 6 应用程序重新开始。 FML.
FML。
I also want to point out that this tutorial is wrong.我还想指出本教程是错误的。 Earlier in it it says requirement is Visual Studio 2019 16.4 or later.
它前面说要求是 Visual Studio 2019 16.4 或更高版本。
I did read this and checked the version of Visual studio I had installed, I met the requirements so I kept going.我确实阅读了这篇文章并检查了我安装的 Visual Studio 的版本,我满足了要求,所以我继续前进。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.