11

After booting up my PC I tried to continue using a previous project I had been working on: ASP.NET MVC Core 6.0.

All of a sudden Microsoft.EntityFrameworkCore was not installed in the solution. After trying to reinstall the Microsoft.EntityFrameworkCore nuget package I received the following errors:

Package restore failed. Rolling back package changes for 'BulkyBook' (my project)
NU1202: Package Microsoft.Extensions.Logging 6.0.0 is not compatible with net6.0 (.NETCoreApp,Version=v6.0). Package Microsoft.Extensions.Logging 6.0.0 does not support any target frameworks.

NU1202: Package Microsoft.Extensions.Options 6.0.0 is not compatible with net6.0 (.NETCoreApp,Version=v6.0). Package Microsoft.Extensions.Options 6.0.0 does not support any target frameworks.

... for all dependencies AND

NU1202: Package Microsoft.EntityFrameworkCore 6.0.5 is not compatible with net6.0 (.NETCoreApp,Version=v6.0). Package Microsoft.EntityFrameworkCore 6.0.0 does not support any target frameworks.

When trying to install ANY nuget packages requiring net6.0 I get the same issue.

I have done a reset of Windows (keeping files but losing all programs) and fully reinstalled Visual Studio 2022.I still have the same issue.

This is killing me, I'm willing to try anything. Image for proof:

Nuget package errors for net6.0

5
  • Could you pls try to delete the bin and obj folder first and follow this section to enable auto install package?
    – Tiny Wang
    Commented Jun 3, 2022 at 3:21
  • I tried deleting the bin and obj folders, modified my project file to add Microsoft.EntityFrameWorkCore v6.0.5 and got the same errors as mentioned in the original post. Any other ideas? Commented Jun 4, 2022 at 0:45
  • If you create another new project in your machine, can it install packages or still the same error?
    – Tiny Wang
    Commented Jun 6, 2022 at 1:21
  • 1
    had a similar issue when opening my solution in a new pc... the issue was that .net 6 sdk was missing in the new pc and got resolved when it was installed. but looks like these error messages are misleading... :(
    – zak
    Commented Sep 24, 2022 at 15:01
  • I am having similar issue installing GitVersion into Net6 console app. I'll post back here if I find the answer. My error is Package GitVersionTool 5.12.0 not compatible with net6.0(.NETCoreApp,Version=v6.0). Package GitVersionTool 5.12.0 supports - net5.0(NetCoreApp,version=v5.0( / any) - net6.0(NetCoreApp,version=v6.0( / any) - net3.1(NetCoreApp,version=v3.1( / any) Commented May 7, 2023 at 16:01

1 Answer 1

0

Quite possibly, your Project file specifies <TargetFramework>net6.0</TargetFramework>. Change this to <TargetFramework>net6.0-windows</TargetFramework> and try again. It might also interest you to know that if <UseWindowsForms>true</UseWindowsForms> has been specified and <OutputType> is absent, you have a class Library with WinForms dependencies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.