简体   繁体   English

卡在 asp.net 核心教程中。 尝试使用 package 管理器控制台添加 EF Core SQL 服务器提供程序不起作用

[英]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.

相关问题 带有ASP.NET Core 2.0的Github OAuth提供程序不起作用 - Github OAuth provider with ASP.NET Core 2.0 does not work 如何在 ASP.NET Core 3.1 中使用 EF Core Cosmos 提供程序 - How to use EF Core Cosmos provider with ASP.NET Core 3.1 EF Core使用NUGET Package Manager控制台或CMD - EF Core to use NUGET Package Manager Console or CMD EF 核心在 ASP.net 核心多层架构中添加迁移 - EF core add migrations in ASP.net core multilayered architecture Asp.Net核心程序包管理器控制台。 安装NuGet库而不创建库/脚本文件夹 - Asp.Net Core Package Manager Console. Installing NuGet library not creating a library/script folder 角色管理器 UI ASP.NET CORE Identity & EF - Role Manager UI ASP.NET CORE Identity & EF 通过 EF Core 连接到 ASP.NET Core 应用程序中的 SQL 服务器时,pipe 的另一端没有进程 - No process is on the other end of pipe while connecting to SQL Server in an ASP.NET Core application via EF Core 在asp.net核心中绑定不起作用 - Bind in asp.net core does not work 将 ASP.NET 内核连接到 SQL 服务器 - Connecting ASP.NET Core to SQL server 在内存数据库提供程序中使用EF core进行asp.net core应用程序的单元测试的优势 - Advantages of using EF core in memory database provider for unit testing of asp.net core application
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM