Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does NuGet download seemingly unnecessary dependencies? [duplicate]

Tags:

c#

nuget

When installing System.Collections.Immutable NuGet downloads assemblies like System.Runtime, even though I already had that assembly installed with .NET 4.6.1.

Also, the directories under lib (like packages\System.Runtime.4.0.0\lib\net45) contain no dll files, just empty files called _._ .

Why is this happening? Why is this necessary? What am I missing here?

NuGet log:

Install-Package System.Collections.Immutable -Version 1.1.37
Attempting to gather dependency information for package 'System.Collections.Immutable.1.1.37' with respect to project 'ConsoleApplication1', targeting '.NETFramework,Version=v4.6.1'
Attempting to resolve dependencies for package 'System.Collections.Immutable.1.1.37' with DependencyBehavior 'Lowest'
Resolving actions to install package 'System.Collections.Immutable.1.1.37'
Resolved actions to install package 'System.Collections.Immutable.1.1.37'
  GET https://www.nuget.org/api/v2/package/System.Collections/4.0.0
Installing System.Collections 4.0.0.
Adding package 'System.Collections.4.0.0' to folder 'd:\workspace\ConsoleApplication1\packages'
Added package 'System.Collections.4.0.0' to folder 'd:\workspace\ConsoleApplication1\packages'
Added package 'System.Collections.4.0.0' to 'packages.config'
Successfully installed 'System.Collections 4.0.0' to ConsoleApplication1
  GET https://www.nuget.org/api/v2/package/System.Diagnostics.Debug/4.0.0
Installing System.Diagnostics.Debug 4.0.0.
Adding package 'System.Diagnostics.Debug.4.0.0' to folder 'd:\workspace\ConsoleApplication1\packages'
Added package 'System.Diagnostics.Debug.4.0.0' to folder 'd:\workspace\ConsoleApplication1\packages'
Added package 'System.Diagnostics.Debug.4.0.0' to 'packages.config'
Successfully installed 'System.Diagnostics.Debug 4.0.0' to ConsoleApplication1
  GET https://www.nuget.org/api/v2/package/System.Globalization/4.0.0
Installing System.Globalization 4.0.0.
Adding package 'System.Globalization.4.0.0' to folder 'd:\workspace\ConsoleApplication1\packages'
Added package 'System.Globalization.4.0.0' to folder 'd:\workspace\ConsoleApplication1\packages'
Added package 'System.Globalization.4.0.0' to 'packages.config'
Successfully installed 'System.Globalization 4.0.0' to ConsoleApplication1
  GET https://www.nuget.org/api/v2/package/System.Linq/4.0.0
Installing System.Linq 4.0.0.
Adding package 'System.Linq.4.0.0' to folder 'd:\workspace\ConsoleApplication1\packages'
Added package 'System.Linq.4.0.0' to folder 'd:\workspace\ConsoleApplication1\packages'
Added package 'System.Linq.4.0.0' to 'packages.config'
Successfully installed 'System.Linq 4.0.0' to ConsoleApplication1
  GET https://www.nuget.org/api/v2/package/System.Resources.ResourceManager/4.0.0
Installing System.Resources.ResourceManager 4.0.0.
Adding package 'System.Resources.ResourceManager.4.0.0' to folder 'd:\workspace\ConsoleApplication1\packages'
Added package 'System.Resources.ResourceManager.4.0.0' to folder 'd:\workspace\ConsoleApplication1\packages'
Added package 'System.Resources.ResourceManager.4.0.0' to 'packages.config'
Successfully installed 'System.Resources.ResourceManager 4.0.0' to ConsoleApplication1
  GET https://www.nuget.org/api/v2/package/System.Runtime/4.0.0
Installing System.Runtime 4.0.0.
Adding package 'System.Runtime.4.0.0' to folder 'd:\workspace\ConsoleApplication1\packages'
Added package 'System.Runtime.4.0.0' to folder 'd:\workspace\ConsoleApplication1\packages'
Added package 'System.Runtime.4.0.0' to 'packages.config'
Successfully installed 'System.Runtime 4.0.0' to ConsoleApplication1
  GET https://www.nuget.org/api/v2/package/System.Runtime.Extensions/4.0.0
Installing System.Runtime.Extensions 4.0.0.
Adding package 'System.Runtime.Extensions.4.0.0' to folder 'd:\workspace\ConsoleApplication1\packages'
Added package 'System.Runtime.Extensions.4.0.0' to folder 'd:\workspace\ConsoleApplication1\packages'
Added package 'System.Runtime.Extensions.4.0.0' to 'packages.config'
Successfully installed 'System.Runtime.Extensions 4.0.0' to ConsoleApplication1
  GET https://www.nuget.org/api/v2/package/System.Threading/4.0.0
Installing System.Threading 4.0.0.
Adding package 'System.Threading.4.0.0' to folder 'd:\workspace\ConsoleApplication1\packages'
Added package 'System.Threading.4.0.0' to folder 'd:\workspace\ConsoleApplication1\packages'
Added package 'System.Threading.4.0.0' to 'packages.config'
Successfully installed 'System.Threading 4.0.0' to ConsoleApplication1
  GET https://www.nuget.org/api/v2/package/System.Collections.Immutable/1.1.37
Installing System.Collections.Immutable 1.1.37.
Adding package 'System.Collections.Immutable.1.1.37' to folder 'd:\workspace\ConsoleApplication1\packages'
Added package 'System.Collections.Immutable.1.1.37' to folder 'd:\workspace\ConsoleApplication1\packages'
Added package 'System.Collections.Immutable.1.1.37' to 'packages.config'
Successfully installed 'System.Collections.Immutable 1.1.37' to ConsoleApplication1
like image 1000
Kalevi Avatar asked Nov 09 '22 18:11

Kalevi


1 Answers

I think this is because of the changes that are coming with dotnet core / cli. It's maintaining the dependency chain, which is much more important in donet core because you don't have a fully installed framework. That explains why lib\net45 folders are empty, there is nothing to actually include because they are part of the BCL installed on your machine.

like image 153
CodingGorilla Avatar answered Nov 14 '22 23:11

CodingGorilla