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

Maybe resolved itself, after resetting emulator and couple restarts - will let you know
@MillerMark A few weeks ago you tweeted that something huge/incredible was coming....what is/was it? (I am hoping s……
Oddly, it won't hit breakpoints in XF .net standard 2 project now either
@JamesMontemagno Updated to 15.7 preview 2 Visual Studio - now having lots of odd thread issues when starting debug……