Warning NU1701 Package ‘Microsoft.AspNet.Mvc 5.2.7’

Warning NU1701 Package ‘Microsoft.AspNet.Mvc 5.2.7’ was restored using ‘.NETFramework,Version=v4.6.1, .NETFramework,Version=v4.6.2, .NETFramework,Version=v4.7, .NETFramework,Version=v4.7.1, .NETFramework,Version=v4.7.2, .NETFramework,Version=v4.8’ instead of the project target framework ‘net5.0’. This package may not be fully compatible with your project.

When I create an MVC project in Visual Studio, it automatically put a reference to Microsoft.AspNet.Mvc. Since I’m now using ASP.NET 5, I started to see several of these warnings stacked in my Warning list.

I right click on my solution and selected “Manage NuGet Packages for Solution…”

On the left, highlighted “Microsoft.AspNet.Mvc”, made sure the project(s) that have it referenced have a check mark next to them on the right.

Clicked “Uninstall”

Searched NugGet for “Microsoft.AspNetCore.Mvc” and installed it to the same projects I just removed the other.

I had to remove “using System.Web.Mvc” references. These broke some “AllowHtml” decoration attributes that I had to remove, as they are no longer needed in .NET Core.

I also had to edit the project file for the main web project and remove the following line:

<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.2.0" />

Made sure the solution builds. If you have any errors, you’ll want to tackle them right away while you still remember what caused them!