无法从 Nuget 包管理器安装 Microsoft.EntityFrameworkCore

Not able to install Microsoft.EntityFrameworkCore from Nuget Package Manager

我正在尝试在我的 ASP.NET Core Web API 项目中安装 Microsoft.EntityFrameworkCore。但是当我尝试安装时出现错误:

Error Package restore failed. Rolling back package changes for 'RabbitMQ'.

Error NU1107 Version conflict detected for Microsoft.EntityFrameworkCore.Abstractions. Install/reference Microsoft.EntityFrameworkCore.Abstractions 3.1.0 directly to project RabbitMQ to resolve this issue. RabbitMQ -> Microsoft.EntityFrameworkCore 3.1.0 -> Microsoft.EntityFrameworkCore.Abstractions (>= 3.1.0) RabbitMQ -> Microsoft.AspNetCore.App 2.1.1 -> Microsoft.EntityFrameworkCore.Abstractions (>= 2.1.1 && < 2.2.0). RabbitMQ P:\Users\vivek.nuna\RabbitMQ\RabbitMQ\RabbitMQ\RabbitMQ.csproj 1

我试过重启 VS,但没有用。

VS 2017 版本 15.8.6

CS 项目文件。

<Project Sdk="Microsoft.NET.Sdk.Web">

  <PropertyGroup>
    <TargetFramework>netcoreapp2.1</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <Folder Include="wwwroot\" />
  </ItemGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.AspNetCore.App" />
    <PackageReference Include="RabbitMQ.Client" Version="5.1.2" />
    <PackageReference Include="Swashbuckle.AspNetCore" Version="4.0.1" />
  </ItemGroup>

</Project>

尽管我能够将它安装在同一台机器上的 .Net Core 控制台应用程序中。

你应该安装Microsoft.EntityFrameworkCore 2.1.11版本