Keep Nuget Packages Out of TFS (Source Control)


Historically, we had kept our Nuget packages in Team Foundation Server (version control).  Due to the recent consistency and stability of Nuget I am starting to move towards excluding Nuget packages from TFS Source control.  They just are not required anymore and Visual Studio can very quickly restore from the internet packages locally on your workstation/build server very quickly now.

So, how do we setup both Visual Studio and TFS to stop putting packages in TFS?  Donovan Brown published a post describing the steps.

a) At the solution level (at same location where your sln file is located) create a folder named .nuget (do this from within Source Control Explorer)

b) Create a file named nuget.config and put this within the .nuget folder.  This file should have the following content.

<?xml version="1.0" encoding="utf-8"?>
    <add key="disableSolutionControlIntegration" value="true"></add>

c) Create a file .tfignore and put at the solution level also.  Within this text file put a single word packages

So at this point, you have a directory .nuget with the nuget.config file within it, and also a text file .tfignore at the solution level.  Remove any packages that have been put in source control previously and check in.

At this point, close Visual Studio and restart.

Build the solution locally and all should be good, do a check in and if everything is good the packages folder is not checked in. Tada…Essentially, we are putting things in place to tell Visual Studio not to check in packages AND we are telling TFS not to check in the packages folder.  Both the config file and the .tfignore files are needed.


My solution folder looks like…






comments powered by Disqus


Recent Tweets

The Most Promising Open Source Projects to Watch for in 2018
Relaxing day, catching up on .NET CORE 2 release information. #Microsoft #AspNetCore
Retweeted by @dyardy .@terrajobst & @runfaster2000 demo features of #dotNET Standard on @ch9! Watch:
Retweeted by @dyardy Now on the latest Xamarin Show Snack Pack: Optimized Lists w/ DataTemplate Selectors in Xamarin.Forms,……
Retweeted by @dyardy CodeRush for Roslyn 17.1.8 is Available