Reputation: 51
I have created a new Solution where I have added a few projects. They are either ASP.NET Core, Class Libraries or NUnit Test projects. Both the ASP.NET and test projects experience the same errors, where I cannot add packages to the projects. The error I get is NU1202, a few examples:
Error NU1202 Package Newtonsoft.Json 10.0.1 is not compatible with netcoreapp3.0 (.NETCoreApp,Version=v3.0).
Package Newtonsoft.Json 10.0.1 does not support any target frameworks.
Error NU1202 Package System.AppContext 4.1.0 is not compatible with netcoreapp3.0 (.NETCoreApp,Version=v3.0).
Package System.AppContext 4.1.0 supports:
- monoandroid10 (MonoAndroid,Version=v1.0)
- monotouch10 (MonoTouch,Version=v1.0)
- netstandard (.NETStandard,Version=v0.0)
- xamarinios10 (Xamarin.iOS,Version=v1.0)
- xamarinmac20 (Xamarin.Mac,Version=v2.0)
- xamarintvos10 (Xamarin.TVOS,Version=v1.0)
- xamarinwatchos10 (Xamarin.WatchOS,Version=v1.0)
These errors comes after I've tried to add Swashbuckle.AspNetCore to my ASP.NET project.
I have tried to clear the caches, checked that the NuGet version is up to date (it is 5.3). I don't know what else I can do. Any suggestions?
Edit: I have tried downgrading, even to netcoreapp2.0. But this does not solve the problem
To be clear, I have only added Swashbuckle.AspNetCore, not Newtonsoft.Json or or System.AppContext, however that is still the error messages i get
Upvotes: 5
Views: 27666
Reputation: 563
If you are installing from NuGet Packages, choose the latest stable version from the version dropdown and then install. It worked for me:)
Upvotes: 0
Reputation: 15312
You have two options:
or
Since you're using a .NET Core 3.0 project, you can use the Swashbuckle NuGet Package that is specifically designed for .NET Core, Swashbuckle.AspNetCore.
You'll need to downgrade your project from .NET Core 3.0 to .NET Core 2.2.
In the csproj
file, change the TargetFramework
version from netcoreapp3.0
to netcoreapp2.2
.
Here's an example csproj
file that uses .NET Core 2.2:
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
</PropertyGroup>
</Project>
Upvotes: -1