I want to update my packages but I got some errors like this:

The error is:

Error NU1202 Package Microsoft.EntityFrameworkCore.Sqlite 5.0.0-rc.1.20451.13 is not compatible with net50 (.NETFramework,Version=v5.0) / win7-x86. Package Microsoft.EntityFrameworkCore.Sqlite 5.0.0-rc.1.20451.13 supports: netstandard2.1 (.NETStandard,Version=v2.1) API E:...\API\API.csproj 1

API.csproj file:

<Project Sdk="Microsoft.NET.Sdk.Web">

  <PropertyGroup>
    <TargetFramework>net5.0</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="8.0.1" />
    <PackageReference Include="CloudinaryDotNet" Version="1.11.0" />
    <PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="3.1.7" />
    <PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="5.0.0-preview.8.20414.8" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="5.0.0-preview.8.20407.4">
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
      <PrivateAssets>all</PrivateAssets>
    </PackageReference>
    <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="5.0.0-preview.8.20407.4" />
    <PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="5.0.0-preview8" />
    <PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="6.7.1" />
  </ItemGroup>

</Project>

nuget package manager

C:\WINDOWS\system32>dotnet --info .NET SDK (reflecting any global.json):
Version: 5.0.100-rc.1.20452.10
Commit: 473d1b592e

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

command line

How can I solve this problem?

5

There are 5 answers

0
Roshna Omer On BEST ANSWER

I had the same issue:

I updated my Visual Studio program from version 16.7 to 16.8 and now, problem solved!

I checked update manually

This solution is written in the comments of this question but I wanted to make it an answer to help others like me

2
Osman Taskiran On

You have to upgrade your nuget installer to latest version.

https://www.nuget.org/packages/Microsoft.EntityFrameworkCore.SqlServer.NetTopologySuite/

https://www.nuget.org/downloads

If you are using Azure Devops, you can add a task step into your pipeline.

- task: UseDotNet@2
      inputs:
        packageType: sdk
        version: 5.0.x

- task: NuGetToolInstaller@1
      inputs:
        versionSpec: ''
        checkLatest: true
0
Guido Neele On

I had a global.json file in my project. After removing it problem was fixed because it mentioned a .net core 3.1 sdk.

0
Kacper Sierakowski On

To develop any ASP.NET Core 5.0 app, you need Visual Studio 2019 version 16.8 or later, with the ASP.NET and web development workload installed.

https://learn.microsoft.com/en-us/dotnet/core/install/windows?tabs=net50

https://learn.microsoft.com/en-us/dotnet/architecture/grpc-for-wcf-developers/create-project

0
Farman Ameer On

Open .csproj file in notepad and change the target version from 3.1 to 2.1 From

<TargetFramework>netstandard5.0</TargetFramework>

To

<TargetFramework>netstandard2.1</TargetFramework>

Save file and close. Clean Solution then rebuild the solution.