Home > .NET > Check in Nuget packages to source controls

Check in Nuget packages to source controls

There are two ways to check in Nuget packages to source controls. ie TFS, SVN. And it turns out neither of them is perfect.

You can add the whole local packages to TFS/SVN, just as how you would do it with external assemblies without Nuget. In TFS it would be easier if you installed power tools which has a windows explorer shell allows you to add files in the SVN style. This the the old school style which always works, and everyone will get exactly the same assemblies and cut the dependency to the internet based Nuget repository.

I don’t see anything wrong with this approach it makes your source control has everything. and make your sources mobile friendly, you don’t need an internet connections in order to get the assemblies as long as you have access to your source control. (ie. in the VM)

Another way of doing it if bit cooler and sounds more recommended. Basically you don’t check in the packages folder at all (same reason as you don’t check in your bin folders). each project has packages.config which contains all the assembly references. That’s basically all you need. Then you’ll need to write some prebuild scripts to get all the assemblies from the internet Nuget repository.

NuGet install NuGetDemo\packages.config -o Packages

You’ll also need to check in Nuget command line utility in order to execute such command. and it will skip the package that already exist on your local. Now this is cooler but with problems too. firstly it requires an internet connection. secondly what if the package author removed his package from the Nuget??? You’re pretty much screwed! Although lets assume that this is pretty rarely happened but possible.

I hope Phil Haack can come up with a better package version management way to solve this problem.  Until then I think I’ll stick with the old-fashion way cause that works anytime anywhere effortlessly considering I have a mobile work station that doesn’t always connect to the internet. I love writing all the cute little utility tool but only if they serve a good purpose.

  1. No comments yet.
  1. No trackbacks yet.

Leave a comment