简体   繁体   English

NU1202: Package 与 netcoreapp2.0 (.NETCoreApp,Version=v3.0) 不兼容

[英]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:你有两个选择:

  1. Use Swashbuckle.AspNetCore使用Swashbuckle.AspNetCore

or或者

  1. Downgrade your project from .NET Core 3.0从 .NET Core 3.0 降级您的项目

Option 1: Use Swashbuckle.AspNetCore选项 1:使用 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 . 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 .

Option 2: Downgrade Project选项 2:降级项目

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.

相关问题 错误 NU1202: Package Microsoft.AspNetCore.Blazor.Cli 0.7.0 与 netcoreapp2.0 (.NETCoreApp,Version=v2.0) 不兼容 - error NU1202: Package Microsoft.AspNetCore.Blazor.Cli 0.7.0 is not compatible with netcoreapp2.0 (.NETCoreApp,Version=v2.0) 项目与netcoreapp2.0不兼容 - Project is not compatible with netcoreapp2.0 软件包与 netcoreapp2.0 不兼容 - Packages are not compatible with netcoreapp2.0 .Net 6 也叫.NetFramework version 6 吗? 它与 .netcoreapp2.0 不兼容吗? - Is .Net 6 also called .NetFramework version 6? and is it not compatible with .netcoreapp2.0? netcoreapp2.0 和 netstandard2.0 - netcoreapp2.0 with netstandard2.0 将配置选项从netcoreapp1.1移植到netcoreapp2.0 - Porting configuration options from netcoreapp1.1 to netcoreapp2.0 在不同的 netstandard2.0 库 NU1202 中安装 netstandard2.0 Nuget 包 - Installing a netstandard2.0 Nuget Package inside a different netstandard2.0 library NU1202 错误 NU1202 Microsoft.EntityFrameworkCore.SqlServer 5.0.0 package 与 net50 不兼容 - Error NU1202 Microsoft.EntityFrameworkCore.SqlServer 5.0.0 package is not compatible with net50 netcoreapp2.0预览版2。 身份配置 - netcoreapp2.0 preview2. Identity configuration 软件包与netcoreapp2.2不兼容 - Package is not compatible with netcoreapp2.2
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM