简体   繁体   中英

Package X is not compatible with netcoreapp3.1

I'm trying to run my .net core 3.1 project in VS 2019 but I'm getting errors like a below during building.

Severity Code Description Project File Line Suppression State Error NU1202 Package System.Diagnostics.DiagnosticSource 4.5.0 is not compatible with netcoreapp3.1 (.NETCoreApp,Version=v3.1).Package System.Diagnostics.DiagnosticSource 4.5.0 does not support any target frameworks. WebApi.Base C:\Users\ilyas.varol.TEST\source\repos\performancemanagementprojects\WebApi.Base\WebApi.Base.csproj

Notes:

  • I made reinstalling all packages and .net core 3.1 sdk
  • The same project is running in another computer

UPDATE

I still haven't solve my problem. Therefore I want to elaborate my question with screenshots. I hope someone can help me.

Error list在此处输入图像描述

Nuget Package Manager > Consolidate

在此处输入图像描述

First, clean nuget caches or delete all files under C:\Users\xxx(current user)\.nuget\packages .

Then, delete bin and obj folder.

Rebuild the project to test again.

I clicked right click on sln and then I clicked "Clean Solution" and Rebuild Solution". Finally, My problem is solved.

Following worked for me on VS 2019,

Tools-->Nuget Package Manager-->Package Manager Settings-->General-->Clear All NuGet Cache(s)

I had the same problem, as mentioned in the docs I updated the target framework .

Specifically, of my class libraries (in Blazor server core 3.1).

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

  <PropertyGroup>
    <TargetFramework>netcoreapp3.1</TargetFramework> //remove this
    <TargetFramework>net6.0</TargetFramework>        //add this
  </PropertyGroup>

</Project>

After this, you need to remove the bin , obj folder and rebuild the project.

This should get you are up and running again.

For me 5.0.10 worked properly. Today the latest version of this NuGet package is 6.0.6 but I tried 5.0.10 and worked properly

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM