packages/repositories.config should not be in packages folder! Please remove

Topics: General
Feb 26, 2015 at 9:45 AM
For every solution you make, you'll have a packages folder with all used (and ever used, unless you clean up) nuget packages on that solution, both in .nupkg and in uncompressed form.

This makes me having i.e. the Entity Framework package about 100 times on my drive (22MBx100=2.2GB) to name just one (of the bigest).

There is a very easy, clean, nice way to optimise working with NuGet packages: having your packages only once on disk, no need to download packages you downloaded earlier (lowering your bandwidth usage and increasing the available bandwith for the rest of the world ;)). It's clean, uses fewer resources, is faster, and it's probably even greener.

What is it ?

Simple, (if you have NTFS) use linked directories (directory symbolic links, or directory junctions). This means you have only one "packages" directory. I.e. "C:\Packages". Then, for each solution, you create a link to that package (i.e. C:> MKLINK /D "C:\MyProjects\CoolProject1\Packages" "C:\Packages"). Your CoolProject1 will now automatically reuse the packages already available in you C:\Packages folder and add new packages if needed.
Cool! Isn't it ?

There's only one guy spoiling the fun: the "packages/repositories.config" file. He is making the whole thing impossible since now, every packages folder must have a repositories.config file that must be different per solution. Hence, sharing the packages folder is not possible...

But why is the repositories.config located in the packages folder ?? I can't think of any good reason. It's just a list of packages.config files (located in the projects). So it's a solution artefact and it should be placed near the solution file.

And to be honest, why does the file exist alltogether ? As I sais, it's just a list of packages.config files. There are other ways to obtain such a list (DIR /S packages.config for instance).

Finally, and that is the core of the problem, the repositories.config creates a dependency from the packages folder to the solution projects, while there is also (by vertue of the used packages, and the packages.config files in each project) a dependency from the projects to the packages folder. I've always learned that 2-way dependencies are a no-go in software design...

So please, please, could you in a next version of NuGet make the repositories.config file disappear ? (It's the simplest solution also to remain backward compatible, and I can't imagine this file to be unavoidable.)