Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How-to fix .NET 5.0 to 6.0 migration error

I have a NetStandard2.1 library that is used for data access in a WebApi I was going to upgrade the WebApi and the data access to .NET 6.0.

dotnet –info shows the following .NET SDKs installed

NET SDKs installed:
 3.1.415 C:\Program Files\dotnet\sdk
 5.0.403 C:\Program Files\dotnet\sdk
 6.0.100-preview.4.21255.9 C:\Program Files\dotnet\sdk
 6.0.100-preview.7.21379.14 C:\Program Files\dotnet\sdk
 6.0.100 C:\Program Files\dotnet\sdk

There are only 3 packages within the data access class library.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

  1. Microsoft.AspNetCore.Identity.EntityFrameworkCore (5.0.10)
  2. Microsoft.EntityframeworkCore (5.0.10)
  3. Microsoft.EntityFrameworkCore.SqlServer (5.0.10)

But when I try to upgrade the packages to 6.0.0 I am receiving a Nuget error of NU1202 for all three packages. Example of errors is:

Error NU1202 Package Microsoft.AspNetCore.Identity.EntityFrameworkCore 6.0.0 is not compatible with netstandard2.1 (.NETStandard,Version=v2.1). Package Microsoft.AspNetCore.Identity.EntityFrameworkCore 6.0.0 supports: net6.0 (.NETCoreApp,Version=v6.0)

Could the two 6.0.0-previews be causing an issue?
Can someone please help with the upgrade issue?
I must be missing something that I should be changing or doing!
Thanks…

Orgbrat

>Solution :

See Plan for Entity Framework Core 6.0:

EF Core 6.0 requires .NET 6. EF Core 6.0 does not target any .NET Standard version; for more information see the future of .NET Standard.

You’ll need to upgrade your library to target net6.0 in order to use Entity Framework 6:

<TargetFramework>net6.0</TargetFramework>

This also means that projects consuming this library will need to target .NET 6.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading