.NET Core 2.2.0
TeamCity Professional 2019.1.2 (build 66342)
build step .NET CLI dotnet restore
error NU1605: Detected package downgrade: System.Runtime from 4.3.1 to 4.3.0. Reference the package directly from the project to select a different version.
error NU1605: MyTestProject -> MyProject -> Microsoft.AspNet.WebApi.Client 5.2.6 -> Newtonsoft.Json 10.0.1 -> System.Runtime.Extensions 4.3.1 -> System.Runtime (>= 4.3.1)
error NU1605: MyTestProject -> MyProject -> Microsoft.AspNet.WebApi.Client 5.2.6 -> Newtonsoft.Json 10.0.1 -> System.Runtime (>= 4.3.0)
Local Visual Studio build runs clean with no such restore errors.
But TeamCity build throws many errors this type.
I have two questions :
- How to reliably resolve this error ?
Please note that adding package references to .csproj is not a good option because my build has a lot of errors of this type. Potentially it would be required to add an explicit PackageReference
to every leaf package in the dependencies tree.
- Why does
MSBUILD
consider this to be an error and not a warning ?
To my eye the version constraints are compatible because 4.3.1
satisfies both constraints System.Runtime (>= 4.3.1)
and System.Runtime (>= 4.3.0)
.
Isn't that what the author of Newtonsoft.Json 10.0.1
intended ?
A similar type of error is happening in four distinct builds ( in four distinct apps ) :
[restore] MyApp.csproj: error NU1605: Detected package downgrade: Microsoft.EntityFrameworkCore.Relational from 2.2.1 to 2.2.0. Reference the package directly from the project to select a different version.
MyApp.csproj: error NU1605: MyApp -> Microsoft.AspNetCore.App 2.2.0 -> Microsoft.EntityFrameworkCore.Design 2.2.1 -> Microsoft.EntityFrameworkCore.Relational (>= 2.2.1)
MyApp.csproj: error NU1605: MyApp -> Microsoft.AspNetCore.App 2.2.0 -> Microsoft.EntityFrameworkCore.Relational (>= 2.2.0 && < 2.3.0)
MyApp.csproj: error NU1605: Detected package downgrade: Microsoft.EntityFrameworkCore from 2.2.1 to 2.2.0. Reference the package directly from the project to select a different version.
MyApp.csproj: error NU1605: MyApp -> Microsoft.AspNetCore.App 2.2.0 -> Microsoft.EntityFrameworkCore.InMemory 2.2.1 -> Microsoft.EntityFrameworkCore (>= 2.2.1)
MyApp.csproj: error NU1605: MyApp -> Microsoft.AspNetCore.App 2.2.0 -> Microsoft.EntityFrameworkCore (>= 2.2.0 && < 2.3.0)
Because I began seeing these errors in all four builds around the same time, and because there are no code commits which plausibly could have caused the errors ( and definitely not across all four apps ), it leads me to believe that something was changed on the Build Agent ( which is shared with others ).
Or what could cause many app restores to simultaneously begin failing with these errors ?