代码之家  ›  专栏  ›  技术社区  ›  ThePerplexedOne

为什么nuget要安装一堆系统名称空间引用?

  •  1
  • ThePerplexedOne  · 技术社区  · 6 年前

    我正试图从nuget安装一个库。我原以为会有3到4个不同的依赖项,但它安装了 System 依赖关系?

    这是日志:

    Attempting to gather dependency information for package 'TwitchLib.Client.2.1.4' with respect to project 'Twitch Logs', targeting '.NETFramework,Version=v4.6'
    Attempting to resolve dependencies for package 'TwitchLib.Client.2.1.4' with DependencyBehavior 'Lowest'
    Resolving actions to install package 'TwitchLib.Client.2.1.4'
    Resolved actions to install package 'TwitchLib.Client.2.1.4'
    Adding package 'Serilog.2.3.0' to folder '\\jgdc01\Users\RyanPearce\Documents\Visual Studio 2015\Projects\Twitch Logs\packages'
    Added package 'Serilog.2.3.0' to folder '\\jgdc01\Users\RyanPearce\Documents\Visual Studio 2015\Projects\Twitch Logs\packages'
    Added package 'Serilog.2.3.0' to 'packages.config'
    Successfully installed 'Serilog 2.3.0' to Twitch Logs
    Adding package 'System.Collections.4.0.11' to folder '\\jgdc01\Users\RyanPearce\Documents\Visual Studio 2015\Projects\Twitch Logs\packages'
    Added package 'System.Collections.4.0.11' to folder '\\jgdc01\Users\RyanPearce\Documents\Visual Studio 2015\Projects\Twitch Logs\packages'
    Added package 'System.Collections.4.0.11' to 'packages.config'
    Successfully installed 'System.Collections 4.0.11' to Twitch Logs
    Adding package 'System.Collections.Concurrent.4.0.12' to folder '\\jgdc01\Users\RyanPearce\Documents\Visual Studio 2015\Projects\Twitch Logs\packages'
    Added package 'System.Collections.Concurrent.4.0.12' to folder '\\jgdc01\Users\RyanPearce\Documents\Visual Studio 2015\Projects\Twitch Logs\packages'
    Added package 'System.Collections.Concurrent.4.0.12' to 'packages.config'
    Successfully installed 'System.Collections.Concurrent 4.0.12' to Twitch Logs
    Adding package 'System.Collections.Specialized.4.3.0' to folder '\\jgdc01\Users\RyanPearce\Documents\Visual Studio 2015\Projects\Twitch Logs\packages'
    Added package 'System.Collections.Specialized.4.3.0' to folder '\\jgdc01\Users\RyanPearce\Documents\Visual Studio 2015\Projects\Twitch Logs\packages'
    Added package 'System.Collections.Specialized.4.3.0' to 'packages.config'
    Successfully installed 'System.Collections.Specialized 4.3.0' to Twitch Logs
    Adding package 'System.Diagnostics.Debug.4.0.11' to folder '\\jgdc01\Users\RyanPearce\Documents\Visual Studio 2015\Projects\Twitch Logs\packages'
    Added package 'System.Diagnostics.Debug.4.0.11' to folder '\\jgdc01\Users\RyanPearce\Documents\Visual Studio 2015\Projects\Twitch Logs\packages'
    Added package 'System.Diagnostics.Debug.4.0.11' to 'packages.config'
    Successfully installed 'System.Diagnostics.Debug 4.0.11' to Twitch Logs
    Adding package 'System.Globalization.4.0.11' to folder '\\jgdc01\Users\RyanPearce\Documents\Visual Studio 2015\Projects\Twitch Logs\packages'
    Added package 'System.Globalization.4.0.11' to folder '\\jgdc01\Users\RyanPearce\Documents\Visual Studio 2015\Projects\Twitch Logs\packages'
    Added package 'System.Globalization.4.0.11' to 'packages.config'
    Successfully installed 'System.Globalization 4.0.11' to Twitch Logs
    Adding package 'System.Linq.4.3.0' to folder '\\jgdc01\Users\RyanPearce\Documents\Visual Studio 2015\Projects\Twitch Logs\packages'
    Added package 'System.Linq.4.3.0' to folder '\\jgdc01\Users\RyanPearce\Documents\Visual Studio 2015\Projects\Twitch Logs\packages'
    Added package 'System.Linq.4.3.0' to 'packages.config'
    Successfully installed 'System.Linq 4.3.0' to Twitch Logs
    Adding package 'System.Net.NameResolution.4.3.0' to folder '\\jgdc01\Users\RyanPearce\Documents\Visual Studio 2015\Projects\Twitch Logs\packages'
    Added package 'System.Net.NameResolution.4.3.0' to folder '\\jgdc01\Users\RyanPearce\Documents\Visual Studio 2015\Projects\Twitch Logs\packages'
    Added package 'System.Net.NameResolution.4.3.0' to 'packages.config'
    Successfully installed 'System.Net.NameResolution 4.3.0' to Twitch Logs
    Adding package 'System.Net.Sockets.4.3.0' to folder '\\jgdc01\Users\RyanPearce\Documents\Visual Studio 2015\Projects\Twitch Logs\packages'
    Added package 'System.Net.Sockets.4.3.0' to folder '\\jgdc01\Users\RyanPearce\Documents\Visual Studio 2015\Projects\Twitch Logs\packages'
    Added package 'System.Net.Sockets.4.3.0' to 'packages.config'
    Successfully installed 'System.Net.Sockets 4.3.0' to Twitch Logs
    Adding package 'System.Reflection.4.1.0' to folder '\\jgdc01\Users\RyanPearce\Documents\Visual Studio 2015\Projects\Twitch Logs\packages'
    Added package 'System.Reflection.4.1.0' to folder '\\jgdc01\Users\RyanPearce\Documents\Visual Studio 2015\Projects\Twitch Logs\packages'
    Added package 'System.Reflection.4.1.0' to 'packages.config'
    Successfully installed 'System.Reflection 4.1.0' to Twitch Logs
    Adding package 'System.Resources.ResourceManager.4.0.1' to folder '\\jgdc01\Users\RyanPearce\Documents\Visual Studio 2015\Projects\Twitch Logs\packages'
    Added package 'System.Resources.ResourceManager.4.0.1' to folder '\\jgdc01\Users\RyanPearce\Documents\Visual Studio 2015\Projects\Twitch Logs\packages'
    Added package 'System.Resources.ResourceManager.4.0.1' to 'packages.config'
    Successfully installed 'System.Resources.ResourceManager 4.0.1' to Twitch Logs
    Adding package 'System.Runtime.Extensions.4.3.0' to folder '\\jgdc01\Users\RyanPearce\Documents\Visual Studio 2015\Projects\Twitch Logs\packages'
    Added package 'System.Runtime.Extensions.4.3.0' to folder '\\jgdc01\Users\RyanPearce\Documents\Visual Studio 2015\Projects\Twitch Logs\packages'
    Added package 'System.Runtime.Extensions.4.3.0' to 'packages.config'
    Successfully installed 'System.Runtime.Extensions 4.3.0' to Twitch Logs
    Adding package 'System.Runtime.InteropServices.4.3.0' to folder '\\jgdc01\Users\RyanPearce\Documents\Visual Studio 2015\Projects\Twitch Logs\packages'
    Added package 'System.Runtime.InteropServices.4.3.0' to folder '\\jgdc01\Users\RyanPearce\Documents\Visual Studio 2015\Projects\Twitch Logs\packages'
    Added package 'System.Runtime.InteropServices.4.3.0' to 'packages.config'
    Successfully installed 'System.Runtime.InteropServices 4.3.0' to Twitch Logs
    Adding package 'Microsoft.Extensions.Logging.Abstractions.1.0.0' to folder '\\jgdc01\Users\RyanPearce\Documents\Visual Studio 2015\Projects\Twitch Logs\packages'
    Added package 'Microsoft.Extensions.Logging.Abstractions.1.0.0' to folder '\\jgdc01\Users\RyanPearce\Documents\Visual Studio 2015\Projects\Twitch Logs\packages'
    Added package 'Microsoft.Extensions.Logging.Abstractions.1.0.0' to 'packages.config'
    Successfully installed 'Microsoft.Extensions.Logging.Abstractions 1.0.0' to Twitch Logs
    Adding package 'Serilog.Extensions.Logging.2.0.2' to folder '\\jgdc01\Users\RyanPearce\Documents\Visual Studio 2015\Projects\Twitch Logs\packages'
    Added package 'Serilog.Extensions.Logging.2.0.2' to folder '\\jgdc01\Users\RyanPearce\Documents\Visual Studio 2015\Projects\Twitch Logs\packages'
    Added package 'Serilog.Extensions.Logging.2.0.2' to 'packages.config'
    Successfully installed 'Serilog.Extensions.Logging 2.0.2' to Twitch Logs
    Adding package 'System.Security.Cryptography.Encoding.4.3.0' to folder '\\jgdc01\Users\RyanPearce\Documents\Visual Studio 2015\Projects\Twitch Logs\packages'
    Added package 'System.Security.Cryptography.Encoding.4.3.0' to folder '\\jgdc01\Users\RyanPearce\Documents\Visual Studio 2015\Projects\Twitch Logs\packages'
    Added package 'System.Security.Cryptography.Encoding.4.3.0' to 'packages.config'
    Successfully installed 'System.Security.Cryptography.Encoding 4.3.0' to Twitch Logs
    Adding package 'System.Security.Cryptography.Primitives.4.3.0' to folder '\\jgdc01\Users\RyanPearce\Documents\Visual Studio 2015\Projects\Twitch Logs\packages'
    Added package 'System.Security.Cryptography.Primitives.4.3.0' to folder '\\jgdc01\Users\RyanPearce\Documents\Visual Studio 2015\Projects\Twitch Logs\packages'
    Added package 'System.Security.Cryptography.Primitives.4.3.0' to 'packages.config'
    Successfully installed 'System.Security.Cryptography.Primitives 4.3.0' to Twitch Logs
    Adding package 'System.Security.Cryptography.Algorithms.4.3.0' to folder '\\jgdc01\Users\RyanPearce\Documents\Visual Studio 2015\Projects\Twitch Logs\packages'
    Added package 'System.Security.Cryptography.Algorithms.4.3.0' to folder '\\jgdc01\Users\RyanPearce\Documents\Visual Studio 2015\Projects\Twitch Logs\packages'
    Added package 'System.Security.Cryptography.Algorithms.4.3.0' to 'packages.config'
    Successfully installed 'System.Security.Cryptography.Algorithms 4.3.0' to Twitch Logs
    Adding package 'System.Security.Cryptography.X509Certificates.4.3.0' to folder '\\jgdc01\Users\RyanPearce\Documents\Visual Studio 2015\Projects\Twitch Logs\packages'
    Added package 'System.Security.Cryptography.X509Certificates.4.3.0' to folder '\\jgdc01\Users\RyanPearce\Documents\Visual Studio 2015\Projects\Twitch Logs\packages'
    Added package 'System.Security.Cryptography.X509Certificates.4.3.0' to 'packages.config'
    Successfully installed 'System.Security.Cryptography.X509Certificates 4.3.0' to Twitch Logs
    Adding package 'System.Net.Security.4.3.0' to folder '\\jgdc01\Users\RyanPearce\Documents\Visual Studio 2015\Projects\Twitch Logs\packages'
    Added package 'System.Net.Security.4.3.0' to folder '\\jgdc01\Users\RyanPearce\Documents\Visual Studio 2015\Projects\Twitch Logs\packages'
    Added package 'System.Net.Security.4.3.0' to 'packages.config'
    Successfully installed 'System.Net.Security 4.3.0' to Twitch Logs
    Adding package 'SuperSocket.ClientEngine.Core.0.10.0' to folder '\\jgdc01\Users\RyanPearce\Documents\Visual Studio 2015\Projects\Twitch Logs\packages'
    Added package 'SuperSocket.ClientEngine.Core.0.10.0' to folder '\\jgdc01\Users\RyanPearce\Documents\Visual Studio 2015\Projects\Twitch Logs\packages'
    Added package 'SuperSocket.ClientEngine.Core.0.10.0' to 'packages.config'
    Successfully installed 'SuperSocket.ClientEngine.Core 0.10.0' to Twitch Logs
    Adding package 'System.Text.RegularExpressions.4.3.0' to folder '\\jgdc01\Users\RyanPearce\Documents\Visual Studio 2015\Projects\Twitch Logs\packages'
    Added package 'System.Text.RegularExpressions.4.3.0' to folder '\\jgdc01\Users\RyanPearce\Documents\Visual Studio 2015\Projects\Twitch Logs\packages'
    Added package 'System.Text.RegularExpressions.4.3.0' to 'packages.config'
    Successfully installed 'System.Text.RegularExpressions 4.3.0' to Twitch Logs
    Adding package 'System.Threading.4.3.0' to folder '\\jgdc01\Users\RyanPearce\Documents\Visual Studio 2015\Projects\Twitch Logs\packages'
    Added package 'System.Threading.4.3.0' to folder '\\jgdc01\Users\RyanPearce\Documents\Visual Studio 2015\Projects\Twitch Logs\packages'
    Added package 'System.Threading.4.3.0' to 'packages.config'
    Successfully installed 'System.Threading 4.3.0' to Twitch Logs
    Adding package 'System.Threading.Timer.4.3.0' to folder '\\jgdc01\Users\RyanPearce\Documents\Visual Studio 2015\Projects\Twitch Logs\packages'
    Added package 'System.Threading.Timer.4.3.0' to folder '\\jgdc01\Users\RyanPearce\Documents\Visual Studio 2015\Projects\Twitch Logs\packages'
    Added package 'System.Threading.Timer.4.3.0' to 'packages.config'
    Successfully installed 'System.Threading.Timer 4.3.0' to Twitch Logs
    Adding package 'TwitchLib.Client.Enums.1.0.0' to folder '\\jgdc01\Users\RyanPearce\Documents\Visual Studio 2015\Projects\Twitch Logs\packages'
    Added package 'TwitchLib.Client.Enums.1.0.0' to folder '\\jgdc01\Users\RyanPearce\Documents\Visual Studio 2015\Projects\Twitch Logs\packages'
    Added package 'TwitchLib.Client.Enums.1.0.0' to 'packages.config'
    Successfully installed 'TwitchLib.Client.Enums 1.0.0' to Twitch Logs
    Adding package 'TwitchLib.Client.Models.1.0.0' to folder '\\jgdc01\Users\RyanPearce\Documents\Visual Studio 2015\Projects\Twitch Logs\packages'
    Added package 'TwitchLib.Client.Models.1.0.0' to folder '\\jgdc01\Users\RyanPearce\Documents\Visual Studio 2015\Projects\Twitch Logs\packages'
    Added package 'TwitchLib.Client.Models.1.0.0' to 'packages.config'
    Successfully installed 'TwitchLib.Client.Models 1.0.0' to Twitch Logs
    Adding package 'WebSocket4Net.0.15.2' to folder '\\jgdc01\Users\RyanPearce\Documents\Visual Studio 2015\Projects\Twitch Logs\packages'
    Added package 'WebSocket4Net.0.15.2' to folder '\\jgdc01\Users\RyanPearce\Documents\Visual Studio 2015\Projects\Twitch Logs\packages'
    Added package 'WebSocket4Net.0.15.2' to 'packages.config'
    Successfully installed 'WebSocket4Net 0.15.2' to Twitch Logs
    Adding package 'TwitchLib.Client.2.1.4' to folder '\\jgdc01\Users\RyanPearce\Documents\Visual Studio 2015\Projects\Twitch Logs\packages'
    Added package 'TwitchLib.Client.2.1.4' to folder '\\jgdc01\Users\RyanPearce\Documents\Visual Studio 2015\Projects\Twitch Logs\packages'
    Added package 'TwitchLib.Client.2.1.4' to 'packages.config'
    Successfully installed 'TwitchLib.Client 2.1.4' to Twitch Logs
    ========== Finished ==========
    

    这让我 packages 超过100MB的文件夹中充满了不需要的lib。

    以前从没经历过。

    有什么想法吗?

    1 回复  |  直到 6 年前
        1
  •  2
  •   Leo Liu    6 年前

    为什么nuget要安装一堆系统名称空间引用?

    恐怕是关于包的依赖性的问题 TwitchLib.Client 我是说, WebSocket4Net SuperSocket.ClientEngine.Core 是的。

    检查错误日志后,您可以找到以下信息:

    试图收集包的依赖项信息 “twitchlib.client.2.1.4”关于项目“twitch logs”, 瞄准' .netframework,版本=v4.6 '

    这意味着目标框架是 .NET 4.6 而不是 .NET Standard 是的。

    为了重现这个问题,我创建了一个项目目标 .net 4.6 ,然后安装nuget包 WebSocket4net网站 ,请 然而 ,确认窗口显示它在安装部分下列出依赖项,这些依赖项似乎来自 WebSocket4net网站 .NETStandard 1.3 依赖项列表:

    enter image description here

    我之前已经报道过类似的问题 NuGet install the wrong dependencies ,您可以尝试安装 Microsoft.Data.Services.Client 5.8.2 到.NET 4.5.2的C项目。此问题已在版本5.8.3中修复。

    所以,要解决这个问题,我们需要联系这个包的作者来更新这个包。同样的问题 supersocket.clientengine.core公司 是的。

    注意:如果不想将这些系统依赖项添加到项目中,可以从项目中删除它们。

    希望这有帮助。