2

I recently added MathNet.Numerics through NuGet to my C# solution. The package directory in the solution folder ballooned to about 50 MB! Yet I can simply download the MathNet dll and use only that, which takes up only 1.5 MB. If I want documentation as well, I can include the XML, which is another 3.5 MB.

Am I using Nuget wrong or is this expected behavior? It seems like it is wasting a lot of space.

TylerH
  • 20,799
  • 66
  • 75
  • 101
Superbest
  • 25,318
  • 14
  • 62
  • 134
  • You could just look at the packages folder's contents.. If you do that, you'll notice that there's a 4MB nupkg file and 7 subfolders each targeting a specific target project combination. You can probably just remove those configurations that you aren't interested in. – Jeroen Vannevel Jun 18 '15 at 23:53
  • @JeroenVannevel Yes, most of the bloat seems to be from multiple Android versions of the package. Wouldn't NuGet break since it expects those to be there, though? – Superbest Jun 19 '15 at 00:04
  • 2
    You can just try it out and see if it does. I deleted net35 and net40, rebuilt the project and it still built. NuGet PM also indicated it was still installed so I assume it wouldn't be a problem. – Jeroen Vannevel Jun 19 '15 at 00:05
  • 1
    Why does it matter? You shouldn't be putting binaries in source control anyway (that's one of the best things about NuGet), and 50 MB is peanuts. – Daniel Mann Jun 20 '15 at 00:09
  • @DanielMann If you've ever been in charge of a large and complex product then you'll realize that sometimes keeping libraries (binaries) under source control is the best option.Nuget has pros and cons, as any system does. – slugster Jun 20 '15 at 02:19
  • @DanielMann Won't the solution be broken if Nuget is expecting to find the package but it it's not there? – Superbest Jun 22 '15 at 15:57

2 Answers2

4

The reason the package contains that many editions of the same version is a conflict of interests:

  • We would like to support a wide range of platforms.
  • We would like to leverage advanced features even if they are only available on some of the platforms (usually only on the full .Net framework, like TPL or System.Numerics), for performance but also for compatibility and usability reasons.
  • Avoid downstream dependency nightmares by only publishing a single package per version, including all platforms.

If this is causing you problems, consider to bring this point up with the team in discuss.mathdotnet.com (new) or maybe open an issue in GitHub.

PS: If NuGet doesn't work well for you, we also provide Zip archives you can handle manually and pick exactly what you need.

Christoph Rüegg
  • 4,626
  • 1
  • 20
  • 34
1

It looks like expected behaviour. It is up to the NuGet package owner to decide how many versions to put in a single package.

You can probably safely delete it, but it'll come back every time you restore the NuGet files. If you are worried about a lot of bloat being included in your build or release, check your .csproj file and make sure you only copy over the MathNet.Numerics.dll version you need.

neverendingqs
  • 4,006
  • 3
  • 29
  • 57
  • Additionaly, as an alternative to binaries in source control/re-downloading, you can copy the package to a local nuget server and use that package source in yoir projects – Ewan Jun 20 '15 at 07:57