Warm tip: This article is reproduced from stackoverflow.com, please click
asp.net-core c# nuget

Problem with restoring nuget packages with asp.net core 2.2

发布于 2020-03-27 10:15:57

I successfully update my projects to netcoreapp2.2. I can restore nuget packages and build the projects without any problems. I use CD/CI and on the build server I receive error message when I restore the nugets. These is from the log:

2018-12-14T12:35:33.4556576Z ##[error]The nuget command failed with exit code(1) and error(NU1607: Version conflict detected for Microsoft.AspNetCore.Authentication.Abstractions. Reference the package directly from the project to resolve this issue. PM.Service.API (>= 1.0.0) -> Microsoft.AspNetCore.Mvc.Formatters.Xml (>= 2.2.0) -> Microsoft.AspNetCore.Mvc.Core (>= 2.2.0) -> Microsoft.AspNetCore.Authorization.Policy (>= 2.2.0) -> Microsoft.AspNetCore.Authentication.Abstractions (>= 2.2.0) PM.Service.API (>= 1.0.0) -> Microsoft.AspNetCore.App (>= 2.1.0) -> Microsoft.AspNetCore.Authentication.Abstractions (>= 2.1.0). NU1607: Version conflict detected for Microsoft.AspNetCore.Hosting. Reference the package directly from the project to resolve this issue. TM.Service.API (>= 1.0.0) -> Microsoft.AspNetCore.Hosting.WindowsServices (>= 2.2.0) -> Microsoft.AspNetCore.Hosting (>= 2.2.0) TM.Service.API (>= 1.0.0) -> Microsoft.AspNetCore.App (>= 2.1.0) -> Microsoft.AspNetCore.Hosting (>= 2.1.0).

In my project I have these package references:

How can I resolve this issue? Thanks

Questioner
Dim_Ka
Viewed
162
Dim_Ka 2018-12-14 23:23

Thank you for your answers. I found the problem. I have a task "NuGet Tool Installer" in my CD process. I update the version of nuget.exe from 4.3.0 to 4.8.1 and now it works. Thank you