找出引用nuget包的包

时间:2017-11-20 14:14:30

标签: .net .net-core

我正在尝试将一些代码转换为.NET CORE 2.0,但是,由于我正在恢复,我得到了很多NU1701警告,说有些软件包是使用.NET461恢复的。有趣的是,我没有参考这些包裹。如何找出哪个N级依赖实际引用了这些包?

它的包的古老版本,所以它肯定是一些第三方依赖。我永远不会引用这些版本的软件包。关于如何找到依赖性源于何处的任何提示?

示例:

NU1701: Package 'Microsoft.AspNet.WebApi.Client 4.0.20710' was restored using '.NETFramework,Version=v4.6.1' instead the project target framework '.NETCoreApp,Version=v2.0'. This may cause compatibility problems.
NU1701: Package 'Microsoft.AspNet.WebApi.Core 4.0.20710' was restored using '.NETFramework,Version=v4.6.1' instead the project target framework '.NETCoreApp,Version=v2.0'. This may cause compatibility problems.
NU1701: Package 'Microsoft.AspNet.WebApi.Client 4.0.20710' was restored using '.NETFramework,Version=v4.6.1' instead the project target framework '.NETCoreApp,Version=v2.0'. This may cause compatibility problems.
NU1701: Package 'Microsoft.AspNet.WebApi.Core 4.0.20710' was restored using '.NETFramework,Version=v4.6.1' instead the project target framework '.NETCoreApp,Version=v2.0'. This may cause compatibility problems.
NU1701: Package 'Microsoft.AspNet.WebApi.WebHost 4.0.20710' was restored using '.NETFramework,Version=v4.6.1' instead the project target framework '.NETCoreApp,Version=v2.0'. This may cause compatibility problems.
NU1701: Package 'Microsoft.AspNet.WebApi.WebHost 4.0.20710' was restored using '.NETFramework,Version=v4.6.1' instead the project target framework '.NETCoreApp,Version=v2.0'. This may cause compatibility problems.
NU1701: Package 'Microsoft.Net.Http 2.0.20710' was restored using '.NETFramework,Version=v4.6.1' instead the project target framework '.NETCoreApp,Version=v2.0'. This may cause compatibility problems.
NU1701: Package 'Microsoft.Net.Http 2.0.20710' was restored using '.NETFramework,Version=v4.6.1' instead the project target framework '.NETCoreApp,Version=v2.0'. This may cause compatibility problems.
NU1701: Package 'Microsoft.Web.Infrastructure 1.0.0' was restored using '.NETFramework,Version=v4.6.1' instead the project target framework '.NETCoreApp,Version=v2.0'. This may cause compatibility problems.
NU1701: Package 'Microsoft.Web.Infrastructure 1.0.0' was restored using '.NETFramework,Version=v4.6.1' instead the project target framework '.NETCoreApp,Version=v2.0'. This may cause compatibility problems.
NU1701: Package 'Swashbuckle.Core 5.6.0' was restored using '.NETFramework,Version=v4.6.1' instead the project target framework '.NETCoreApp,Version=v2.0'. This may cause compatibility problems.
NU1701: Package 'Swashbuckle.Core 5.6.0' was restored using '.NETFramework,Version=v4.6.1' instead the project target framework '.NETCoreApp,Version=v2.0'. This may cause compatibility problems.
NU1701: Package 'WebActivatorEx 2.0.0' was restored using '.NETFramework,Version=v4.6.1' instead the project target framework '.NETCoreApp,Version=v2.0'. This may cause compatibility problems.
NU1701: Package 'WebActivatorEx 2.0.0' was restored using '.NETFramework,Version=v4.6.1' instead the project target framework '.NETCoreApp,Version=v2.0'. This may cause compatibility problems.

1 个答案:

答案 0 :(得分:1)

找到解决方案:

  1. 将nuget恢复管道传输到日志
  2. 从日志中选择字符串project.assets.json
  3. 在每个Select-String Microsoft.AspNet.WebApi.Core
  4. 上运行project.assets.json
  5. 在编辑器中打开匹配的。查看依赖于Microsoft.Aspnet.WebApi.Core的依赖关系(例如)
  6. 就我而言,它是Swashbuckle,它是一个.NET完整框架版本。切换到Swachbuckle.AspNetCore,依赖关系消失了。