检测到 Microsoft.EntityFrameworkCore.Install 的版本冲突 [英] Version Conflict detected for 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.
- 创建一个新的解决方案 (EFDemo)
- 向名为 EFDemo.BL 的解决方案添加一个新的 .net Core 类库
- 将以下 Nuget 包添加到项目 EFDemo.BL(因为我正在为我的新项目使用现有数据库)
- Microsoft.EntityFrameworkCore.SqlServer (v2.2.1)
- Microsoft.EntityFraneworkCore.Tools (v2.2.1)
- 添加一个名为 EFDemo.Api 的新 .net 核心 Web 应用程序并选择 API 项目模板.
- 添加从 EFDemo.BL 到 EFDemo.Api 的引用.
- 构建并查看失败.
我已经查看了以下帖子,但它的解决方案对我不起作用,因为我在我的任何 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,重新启动了一百万次,但仍然无法理解问题所在.
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>
这立即有所帮助,错误消失了.
This helped straight away and the error dissapeared.
这篇关于检测到 Microsoft.EntityFrameworkCore.Install 的版本冲突的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!