How To Exclude The Packages Folder From TFS

Chuck Lafferty
Confident Coder
Published in
1 min readJun 19, 2016

--

It’s a good practice to ignore your packages folder from TFS as source control repositories are intended to store your source code, not binary files. Here is how i was able to ignore the packages folder in TFS

How To Ignore the Nuget Packages Folder

  1. Add a .tfignore file to the same folder level as your packages folder. If you are on windows you can create a .tfignore file by right clicking in your folder > New Text Document.txt > rename the file “.tfignore.” (notice the 2 dots, one at the beginning and one at the end. Windows needs the extra dot at the end to fake out an extension)
  2. Open the .tfignore file and add this text
\packages
!\packages\repositories.config

3. In the same folder where both your tfignore file and packages folder are, create a folder called “.nuget” if one doesn’t already exist

4. In the .nuget folder create a file called Nuget.Config, if one doesn’t exist. Add this text to it

<?xml version=”1.0" encoding=”utf-8"?> 
<configuration>
<solution>
<add key=”disableSourceControlIntegration” value=”true” />
</solution>
</configuration>

5. Make sure to check all your changes into TFS

6. Finally delete your packages folder from TFS

TFS never does a hard delete. There is a manual way though. Continue to my next post where i describe how to permanently destory TFS items. How to permanently delete items from TFS.

--

--