question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

NuGet Package Manager attempting to add .NET 5.0 updates to .NET Core 3.1 application

See original GitHub issue

When I go into Tools | NuGet Package Manager | Manage NuGet Package for Solution, it shows me there are 12 updates available.

But when I attempt to update them all, I get errors.

NU1202: Package Microsoft.VisualStudio.Web.CodeGeneration 5.0.0 is not compatible with netcoreapp3.1 (.NETCoreApp,Version=v3.1). Package Microsoft.VisualStudio.Web.CodeGeneration 5.0.0 supports: net5.0 (.NETCoreApp,Version=v5.0)
NU1202: Package Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore 5.0.0 is not compatible with netcoreapp3.1 (.NETCoreApp,Version=v3.1). Package Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore 5.0.0 supports: net5.0 (.NETCoreApp,Version=v5.0)
NU1202: Package Microsoft.VisualStudio.Web.CodeGeneration.Utils 5.0.0 is not compatible with netcoreapp3.1 (.NETCoreApp,Version=v3.1). Package Microsoft.VisualStudio.Web.CodeGeneration.Utils 5.0.0 supports: net5.0 (.NETCoreApp,Version=v5.0)
NU1202: Package Microsoft.VisualStudio.Web.CodeGeneration.Contracts 5.0.0 is not compatible with netcoreapp3.1 (.NETCoreApp,Version=v3.1). Package Microsoft.VisualStudio.Web.CodeGeneration.Contracts 5.0.0 supports: net5.0 (.NETCoreApp,Version=v5.0)
NU1202: Package Microsoft.VisualStudio.Web.CodeGenerators.Mvc 5.0.0 is not compatible with netcoreapp3.1 (.NETCoreApp,Version=v3.1). Package Microsoft.VisualStudio.Web.CodeGenerators.Mvc 5.0.0 supports: net5.0 (.NETCoreApp,Version=v5.0)
Package restore failed. Rolling back package changes for 'SolutionName'.

I can see there are incompatibility issues between .NET Core 3.1 and .NET 5.0 but I don’t know why.

Why is NuGet Package Manager trying to add .NET 5.0 updates to a .NET Core 3.1 application?

UPDATE

I kind of preferred to stay with .NET Core 3.1 but decided to try updating the project to .NET 5.0 and see what happened.

After updating the project, I tried to update the packages again. This time I get a different error.

System.NullReferenceException: Object reference not set to an instance of an object.
   at NuGet.PackageManagement.UI.UIActionEngine.<>c.<ResolveActionsForUpdateAsync>b__9_0(PackageIdentity package)
   at System.Linq.Enumerable.WhereListIterator`1.MoveNext()
   at System.Linq.Enumerable.Any[TSource](IEnumerable`1 source)
   at NuGet.PackageManagement.UI.UIActionEngine.<ResolveActionsForUpdateAsync>d__9.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
   at NuGet.PackageManagement.UI.UIActionEngine.<>c__DisplayClass11_0.<<PerformActionImplAsync>b__0>d.MoveNext()
Time Elapsed: 00:00:00.0111119
========== Finished ==========

I’m really not sure why I’m getting any of these errors. Are there known issues? Can anyone help me understand why things aren’t working?

Note: Before upgrading my application to .NET Core, I also updated Visual Studio to version 16.8.2.

Further technical details

  • ASP.NET Core version 3.1
  • Visual Studio Version 16.8.0 (Windows 10)

.NET SDK (reflecting any global.json): Version: 5.0.100 Commit: 5044b93829

Runtime Environment: OS Name: Windows OS Version: 10.0.19041 OS Platform: Windows RID: win10-x64 Base Path: C:\Program Files\dotnet\sdk\5.0.100\

Host (useful for support): Version: 5.0.0 Commit: cf258a14b7

.NET SDKs installed: 3.1.401 [C:\Program Files\dotnet\sdk] 5.0.100 [C:\Program Files\dotnet\sdk]

.NET runtimes installed: Microsoft.AspNetCore.All 2.1.23 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.App 2.1.23 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 3.1.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 5.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 2.1.23 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 3.1.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 5.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 3.1.9 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 5.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:28 (14 by maintainers)

github_iconTop GitHub Comments

4reactions
Pilchiecommented, Jan 21, 2021

NuGet doesn’t block it, and it’s likely that it will work, but it’s not what we typically test. Your best bet is to use the latest patch NuGet packages that correspond to the major.minor of your target.

3reactions
AraHaancommented, Jul 20, 2021

Has this been fixed? I feel like people forgot about this issue until now.

Read more comments on GitHub >

github_iconTop Results From Across the Web

NuGet Package Manager attempting to add .NET 5.0 ...
NET Core 3.1 application, in the NuGet Package Manager, it just shows that there has some package which have updates, it will not...
Read more >
Unable to install a few NuGets on .net 5 in a new vanilla ...
Select Option NUGET PACKAGE MANAGER > GENERAL; In General, click on button CLEAR ALL NUGET CACHE(S) await a few seconds; Try install again....
Read more >
'EntityFramework.Core.Tools' nuget package installation ...
Based on your description, I tried to create a new Asp.net core 3.1 application, and then install the Entity Framework Core related package,...
Read more >
Product Installation - DotNet Core Version Requirement
The project in question is an ASP DotNet Core 3.1 project. However, when attempting to install GemBox.Spreadsheet via the NuGet Package ...
Read more >
Unable to resolve dependencies of NuGet packages
When you upgrade the site by installing Telerik.Sitefinity.All NuGet package, Visual Studio throws the following error: Unable to resolve dependencies.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found