+-
c# – 对于.Net Core 2.1项目,为什么Nuget恢复.Net 4.6.1包?
如果.Net Core没有软件包,我们如何在Install-Package命令期间强制执行严格的.Net运行时版本检查?

Install-package command, why does Visual Studio even, restores .Net
4.6.1 version, just to give a runtime error at later stages!

我确信VS团队已经考虑过了,必须有理由!
以及验证& amp;和Install-Package期间严格的运行时版本检查.

警告:

Warning NU1701 Package ‘Microsoft.AspNet.Identity.Core 2.2.2’ was
restored using ‘.NETFramework,Version=v4.6.1’ instead of the project
target framework ‘.NETStandard,Version=v2.0’. This package may not be
fully compatible with your project.

编辑:
我刚刚使用了一个完整的.net框架包作为示例.

意图是询问如何防止它在Nuget包管理器中发生.

Warning NU1701 Package <any full .net framework package> was
restored using ‘.NETFramework,Version=v4.6.1’ instead of the project
target framework ‘.NETStandard,Version=v2.0’. This package may not be
fully compatible with your project.

最佳答案
微软在 this GitHub issue年对此进行了解释.引用相关部分:

[…]

Whenever you use NuGet packages that go through the compat shim you’ll get a warning like this:

Warning NU1701: Package ‘Huitian.PowerCollections 1.0.0’ was restored using ‘.NETFramework,Version=v4.6.1’ instead of the project target framework ‘.NETCoreApp,Version=v2.0’. This package may not be fully compatible with your project.

  
  我们确保每次构建时都会收到此警告(仅在程序包恢复期间),以确保您不会意外忽略它.
  
  这里的想法是我们无法知道.NET Framework二进制文件是否真正起作用.例如,它可能依赖于WinForms.为了确保您不会浪费时间对无法正常工作的事情进行故障排除,我们会告诉您,您可能会失控.当然,你必须忽略的警告令人讨厌.因此,我们建议您测试您的应用程序/库,如果您确信一切正常,则禁止显示警告:
  
  […]

因此,如果包工作,那么您可以取消警告.如果没有,您将不得不使用不同的包或等待包支持您的目标框架.

点击查看更多相关文章

转载注明原文:c# – 对于.Net Core 2.1项目,为什么Nuget恢复.Net 4.6.1包? - 乐贴网