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

19 Types of Developers Explained…
Can't Afford Photoshop? Here Is The Best Free Drawing Software | Digital Trends…
Retweeted by @dyardy Fun day christening Amazon’s latest wind farm. #RenewableEnergy
Retweeted by @dyardy Hey C# peeps, we’re trying C# in browser with reference content. Try it here:… reply with feedback /cc @LadyNaggaga
23 Amazing Vintage Photographs Taken Inside WWII Tank Factories ~ vintage everyday…