[英]NU1202: Package is not compatible with netcoreapp2.0 (.NETCoreApp,Version=v3.0)
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.
它们是 ASP.NET 内核、Class 库或 NUnit 测试项目。 Both the ASP.NET and test projects experience the same errors, where I cannot add packages to the projects.
ASP.NET 和测试项目都遇到相同的错误,我无法将包添加到项目中。 The error I get is NU1202, a few examples:
我得到的错误是 NU1202,举几个例子:
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.这些错误是在我尝试将 Swashbuckle.AspNetCore 添加到我的 ASP.NET 项目之后出现的。
I have tried to clear the caches, checked that the NuGet version is up to date (it is 5.3).我试图清除缓存,检查 NuGet 版本是否是最新的(它是 5.3)。 I don't know what else I can do.
我不知道我还能做什么。 Any suggestions?
有什么建议么?
Edit: I have tried downgrading, even to netcoreapp2.0.编辑:我尝试过降级,甚至降级到 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需要明确的是,我只添加了 Swashbuckle.AspNetCore,而不是 Newtonsoft.Json 或 System.AppContext,但这仍然是我得到的错误消息
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 . 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.您需要将项目从 .NET Core 3.0 降级到 .NET Core 2.2。
In the csproj
file, change the TargetFramework
version from netcoreapp3.0
to netcoreapp2.2
.在
csproj
文件中,将TargetFramework
版本从netcoreapp3.0
更改为netcoreapp2.2
。
Here's an example csproj
file that uses .NET Core 2.2:这是使用 .NET Core 2.2 的示例
csproj
文件:
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
</PropertyGroup>
</Project>
If you are installing from NuGet Packages, choose the latest stable version from the version dropdown and then install.如果您从 NuGet 包安装,请从版本下拉列表中选择最新的稳定版本,然后安装。 It worked for me:)
它对我有用:)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.