为Microsoft.EntityFrameworkCore.Install检测到版本冲突 [英] Version Conflict detected for Microsoft.EntityFrameworkCore.Install

查看:1148
本文介绍了为Microsoft.EntityFrameworkCore.Install检测到版本冲突的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

将asp.net核心api添加到我正在处理的现有项目中时,出现以下错误。

I am getting the following error when adding an asp.net core api to an existing project I am working on.


版本检测到Microsoft.EntityFrameworkCore.Install / reference Microsoft.EntityFrameworkCore 2.2.1的冲突,直接将其投影到项目中以解决此问题。

"Version Conflict detected for Microsoft.EntityFrameworkCore.Install/reference Microsoft.EntityFrameworkCore 2.2.1 directly to project to resolve this issue"

添加Nuget程序包,但在许多不同的程序包中出现进一步的版本冲突,并且该过程始终失败。
起初我以为这可能是我的项目的问题,所以我从头开始了一个新的解决方案,并设法通过几个简单的步骤复制了该问题。

I tried to add the Nuget package but get further version conflicts across a number of different packages and the process always fails. At first I thought this may be an issue with my project so I started a new solution from scratch and managed to replicate the issue with a few simple steps.


  1. 创建新解决方案(EFDemo)

  2. 向解决方案中添加新的.net Core类库,名为EFDemo.BL

  3. 将以下Nuget软件包添加到项目EFDemo.BL中(因为我正在为新项目使用现有数据库)

  4. Microsoft.EntityFrameworkCore.SqlServer(v2.2.1)

  5. Microsoft.EntityFraneworkCore.Tools(v2.2.1)

  6. 添加一个名为EFDemo.Api的新.net核心Web应用程序,然后选择API项目模板。

  7. 将EFDemo.BL的引用添加到EFDemo.Api。

  8. 构建并查看失败。

  1. Create a new solution (EFDemo)
  2. Add a new .net Core class library to the solution called EFDemo.BL
  3. Add the following Nuget packages to project EFDemo.BL (as I'm using an existing database for my new project)
  4. Microsoft.EntityFrameworkCore.SqlServer (v2.2.1)
  5. Microsoft.EntityFraneworkCore.Tools (v2.2.1)
  6. Add a new .net core web application called EFDemo.Api and select the API project template.
  7. Add a reference from EFDemo.BL to EFDemo.Api.
  8. Build and see the failure.

我已经查看了以下帖子,但是它的解决方案对我不起作用,因为我在任何csproj文件中都没有引用 Microsoft.EntityFrameworkCore。
检测到NuGet软件包的版本冲突

I have reviewed the following post but its solution does not work for me as I have no reference to "Microsoft.EntityFrameworkCore" in any of my csproj files. Version conflict detected for NuGet packages.

我还重新安装了.net SDK,重新启动了100万次,但仍然无法理解问题所在。

I have also reinstalled .net SDK, rebooted a million times and still can't understand what the issue is.

推荐答案

我最近遇到了相同的错误。

I have encountered the same error recently.

我为解决此问题所做的工作:

What I have done to sort this out:

已安装.Net Core 2.2 SDK

Installed .Net Core 2.2 SDK

然后在我的项目中,我已经更改了所有.csproj文件:

Then in my project I have changed in all .csproj files:

  <PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>

而之前是:

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

错误消失了。

这篇关于为Microsoft.EntityFrameworkCore.Install检测到版本冲突的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆