修复“Package xxx is not compatible with netcoreapp2.0 (.NETCoreApp,Version=v2.0)" [英] Fix For "Package xxx is not compatible with netcoreapp2.0 (.NETCoreApp,Version=v2.0)"

查看:20
本文介绍了修复“Package xxx is not compatible with netcoreapp2.0 (.NETCoreApp,Version=v2.0)"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用框架 4.6.1 创建了一个空白解决方案,并添加了一个项目核心 2.0.此错误显示在许多包的输出中Package xxx is not compatible with netcoreapp2.0 (.NETCoreApp,Version=v2.0)".我该如何解决?

I created a blank solution with framework 4.6.1 and add a project core 2.0. This error show in output for many package 'Package xxx is not compatible with netcoreapp2.0 (.NETCoreApp,Version=v2.0)'. How Can I Fix it?

推荐答案

如果您尝试安装的包确实支持 .NET CORE 2.0,您可以尝试使其工作的几件事>.

Couple of things you could try to make it work, provided the packages that you are trying to install really do support .NET CORE 2.0.

  1. 确保您的 VS 使用的是 NuGet 4.3 或更高版本.在 Visual Studio 中,转到帮助 -> 关于 Visual Studio -> 注意 Nuget 版本并根据需要进行更新.
  2. 如果这不起作用,您可以尝试删除本地包缓存,这很可能位于以下位置:

  1. Make sure your VS is using NuGet 4.3 or greater. Within Visual Studio, go to Help -> About Visual Studio -> Notice the Nuget version and update if required.
  2. If this doesn't work you can try deleting the local packages cache, which most likely is at the following location:

C:Users{Your_User_Name}.nugetpackages

C:Users{Your_User_Name}.nugetpackages

并再次尝试恢复软件包.

and try restoring the packages again.

如果您仍然面临同样的问题,请确保您的 .NET Core 2.0 SDK 和 VS2017 设置完全成功.如果不确定,您可以尝试重新安装相同的.

If you still face the same problem, make sure your setup of .NET Core 2.0 SDK and VS2017 was entirely successful. If unsure, you can try reinstalling the same.

你最后的赌注是修补包裹本身.正如您现在已经猜到的那样,这与其说是实际解决方案,不如说是一种黑客攻击.转到上述位置并找到在还原时出错的包(与包同名的文件夹).在包中,找到并编辑 {Package Name}.nuspec 文件并添加以下标记:

Your last bet is tinkering with the package itself. As you would have guessed by now this is more of a hack than an actual solution. Go to the above mentioned location and find the package that's giving errors while restoring (a folder with the same name as the package). Within the package, find and edit the {Package Name}.nuspec file and add the following tag:

组 targetFramework=".NETStandard2.0"

group targetFramework=".NETStandard2.0"

并通过从 "group targetFramework=".NETStandard1.0" 标签复制来添加内容.保存并关闭.打开同一目录中的 lib 文件夹并创建 em>netstandard1.0 文件夹并将副本重命名为 netstandard2.0

and add content to it by copying from the "group targetFramework=".NETStandard1.0" tag. Save and close. Open the lib folder within the same directory and create a copy of the netstandard1.0 folder and rename the copy as netstandard2.0

希望这会有所帮助.

这篇关于修复“Package xxx is not compatible with netcoreapp2.0 (.NETCoreApp,Version=v2.0)"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆