Ashkan Sirous Ashkan Sirous - 1 year ago 75
Git Question

nuget dlls missing after check-outing from git

I have a C# solution containing different projects. On those projects, I have some normal nuget packages like Newtonsoft.Json, EntityFramework , etc. But when I checkout my source on another machine, and build it, it won't copy the Dllsenter image description here

I've committed the whole solution folder to git and I can see the package folder and the contents in Bitbucket. What did I do wrong?

P.S: I know that I can run below to restore my packages, but that is a big pain.
P.S.S: I've searched and saw this and this. I am looking for a way to prevent it from happening again

nuget install packages.config

Answer Source

The idiomatic way to use NuGet (unlike npm, for example, where it's typical to commit node_packages) is to commit only your packages.config. Visual Studio will detect missing packages in the packages/ folder and restore them on build, and nuget restore at the command line will do the same.

The reason for this is that binaries are larger than text files, and not diffable (i.e. storing a delta isn't possible). I'm not sure git even works that way as svn did, but the authors of nuget aren't writing just for those using git.

If you're concerned about packages going missing, I have two points:

  1. are quite careful about that not being possible. They've set things up so that packages can only be soft-deleted, which means a restore can see those versions, while a nuget install will not.
  2. Many people run their own internal package server (like Klondike) which acts as a kind of proxy to This is also beneficial if you want to package internal libraries and distribute them in your projects using nuget, without publishing them to the internets.