Monday, March 9, 2015

Managing NuGet in your TFS Source Control Repository

When I first began working with NuGet and TFS, I followed the old standard of simply checking in all of the NuGet packages into my TFS repository.

As you can probably guess, this quickly became a nightmare with all of the frequent updates to NuGet packages building up and increasingly convoluting my source control repository.

Therefore, I began investigating better ways to manage my NuGet Packages in conjunction with TFS.

Well, with NuGet's recent support for Automatic Package Restore, I decided to try and use this with TFS to remove the excess of folders being created for each project I created.

Well, after turning on NuGet Automatic Package Restore in Visual Studio, I determined I still had to check in the following files into my TFS Source Control Repository:

  1. The .nuget folder along with the NuGet.config file
  2. The solution containing just a reference to the .nuget folder containing the single NuGet.config file
  3. The packages folder containing only the repositories.config file pointing to all of the packages.config files referenced throughout the solution

Once I followed the above steps, my check-ins into TFS were no longer checking in the associated NuGet packages in the packages folder, thereby allowing me to keep my source control repository clean of numerous binary files and folders!!

In the end, this is how my source control structure in TFS ended up looking like:


No comments:

Post a Comment