Excluding folders and files when adding to source control

Nov 2016 Update: I’ve had a few people reach out to me over the years and ask about how to do this in 2013, 2015, etc. The answer is to use a .tfignore file as outlined here.

In Team Foundation Server when you are adding items to source control, Microsoft automatically excludes certain folders and files:

image

This is helpful when adding a folder (especially with subfolders) of files, specifically Visual Studio projects. The thinking is that you typically don’t want to add files in Debug, Release, or ClientBin folders as well as certain binary files (.pdb, .obj, .dll, .exe, etc.). You can always recreate them later as needed.

There are times, however, that a team may want to add .dll files (for example) to source control. For those situations, a user can either clear the *.dll out of the list before adding, or click the Include Items button on the next screen:

image

But what if a user wants to change the default list of excluded folders and files? Easy, just change the ExcludeMasks value in the registry. Visual Studio 2010 Team Explorer looks at these two keys in this order:

  1. HKEY_CURRENT_USER\SOFTWARE\Microsoft\VisualStudio\10.0\TeamFoundation\SourceControl\AddOptions\ExcludeMasks
  2. HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\10.0\TeamFoundation\SourceControl\AddOptions\ExcludeMasks

All you have to do is make the change:

image

Exit and re-run Visual Studio and see that the defaults are different now (no *.dll anymore):

image

Pin It

Comments are closed.