Keep Nuget Packages Out of TFS (Source Control)

tfs3

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"?>
<configuration>
  <solution>
    <add key="disableSolutionControlIntegration" value="true"></add>
  </solution>
</configuration>

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…

image

 

Reference: http://donovanbrown.com/post/How-to-keep-packages-folder-out-of-TFVC

https://www.youtube.com/watch?v=BfKcTX8NxAQ

Author

david

comments powered by Disqus

Categories

Recent Tweets

Retweeted by @dyardy Chance The Rapper just won this season of SNL https://t.co/F3XLDf4PSa
Retweeted by @dyardy It is amazing to me the degree to which #vuejs just works.
Twitter does a great job of making me feel guilty that I am taking a break.