[英]Version Conflict detected for Microsoft.EntityFrameworkCore.Install
I am getting the following error when adding an asp.net core api to an existing project I am working on.将 asp.net core api 添加到我正在处理的现有项目时,出现以下错误。
"Version Conflict detected for Microsoft.EntityFrameworkCore.Install/reference Microsoft.EntityFrameworkCore 2.2.1 directly to project to resolve this issue" “为 Microsoft.EntityFrameworkCore.Install/reference Microsoft.EntityFrameworkCore 2.2.1 直接检测到版本冲突以解决此问题”
I tried to add the Nuget package but get further version conflicts across a number of different packages and the process always fails.我尝试添加 Nuget 包,但在许多不同的包中出现了进一步的版本冲突,并且该过程总是失败。 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.起初我认为这可能是我的项目的一个问题,所以我从头开始一个新的解决方案,并通过几个简单的步骤设法复制了这个问题。
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.我已经查看了以下帖子,但它的解决方案对我不起作用,因为我在任何 csproj 文件中都没有提到“Microsoft.EntityFrameworkCore”。 Version conflict detected for NuGet packages . 检测到 NuGet 包的版本冲突。
I have also reinstalled .net SDK, rebooted a million times and still can't understand what the issue is.我还重新安装了 .net SDK,重新启动了一百万次,但仍然无法理解问题是什么。
I have encountered the same error recently.我最近遇到了同样的错误。
What I have done to sort this out:我做了什么来解决这个问题:
Installed .Net Core 2.2 SDK安装.Net Core 2.2 SDK
Then in my project I have changed in all .csproj files:然后在我的项目中,我在所有 .csproj 文件中进行了更改:
<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
whereas before it was:而在此之前:
<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
This helped straight away and the error dissapeared.这立即有所帮助,错误消失了。
The answer to this is quite difficult to catalog because I made many changes while trying to figure this out.对此的答案很难编目,因为我在试图弄清楚这一点时做了很多更改。 In the end, I believe the following steps fixed my issue:最后,我相信以下步骤解决了我的问题:
Now to do some work instead of fighting with my tools!现在做一些工作而不是用我的工具战斗!
For me, it helped this article, it was a very simple change on the configuration, which I forgot to change:对我来说,它对这篇文章有帮助,这是对配置的一个非常简单的更改,我忘记更改了:
<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
</PropertyGroup>
https://dotnetcoretutorials.com/2018/11/18/how-to-target-net-core-2-2/ https://dotnetcoretutorials.com/2018/11/18/how-to-target-net-core-2-2/
I am not sure what package you have installed in your project.我不确定您在项目中安装了什么包。
But now days visual studio add just one nuget packages which includes all of required package for asp.net core application.但是现在,visual studio 只添加了一个 nuget 包,其中包括 asp.net 核心应用程序所需的所有包。
Try installing this package and remove all other package and see it that works for you.尝试安装此软件包并删除所有其他软件包,看看它是否适合您。
Microsoft.AspNetCore.All微软.AspNetCore.All
This way you will not have version conflict at least within Microsoft packages.这样你至少不会在 Microsoft 包中发生版本冲突。 You can then verify other external package that you might have installed which is causing problem.然后,您可以验证您可能已安装的其他导致问题的外部包。
I fixed this just installing .NET Core 2.2 and changing TargetFramework tag to netcoreapp2.我修复了这个问题,只是安装了 .NET Core 2.2 并将 TargetFramework 标记更改为 netcoreapp2。
<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
</PropertyGroup>
这对我有帮助并且让我感到沮丧
<TargetFramework>netcoreapp2.2</>
I had followed the steps to solve my problem我已经按照步骤解决了我的问题
Hope this helps.希望这可以帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.