NU1608 Detected package version outside of dependency constraint: Microsoft.AspNetCore.App 2.1.1 requires

Viewed 1606

In the solution that I have to work with, I have to add a test harness for a number of library projects. It has to be a .NET Core 2.1 (and it will stay this way for the reasons beyond my control) ASP.NET web service.

NU1608 Detected package version outside of dependency constraint: Microsoft.AspNetCore.App 2.1.1 requires Microsoft.AspNetCore.Razor.Design (>= 2.1.1 && < 2.2.0) but version Microsoft.AspNetCore.Razor.Design 2.2.0 was resolved.

I created a brand new project of the type "Asp Net Core Web Application", and when I built, I got the error above. What is the meaning and reason of this error in a brand-new project created by VS?

2 Answers

You are getting this issue, because while your Microsoft.AspNetCore.Razor.Design version is 2.2.0 but ASP.NET Core application is still at 2.1.

You just need to change your package Microsoft.AspNetCore.Razor.Design2.2.0 to Microsoft.AspNetCore.Razor.Design2.1.x in your project file.

The issue described in Microsoft documentation as NuGet Warning NU1608:

A resolved package is higher than a dependency constraint allows. This means that a package referenced directly by a project overrides dependency constraints from other packages.

Possible solution:

Update the package version according to its dependency constraints.

For example in this case:

Update Microsoft.AspNetCore.Razor.Design 2.2.0 to 2.1.x according to its dependency Microsoft.AspNetCore.App 2.1.1

enter image description here

Related