How To Exclude Files from TFS Source Control
A few days ago I wrote a post advising you to *not* put the Visual Studio .vsmdi file under source control. If you’re wondering how to do this using Team Foundation Server, you’ve got a couple options:
- Assuming you have the necessary permissions, in Team Explorer right-click on the root server name, hover over Team Foundation Server Settings, then select Source Control File Types. A window opens listing all of the file types TFS recognizes out-of-the-box. Simply select the file type(s) you want to exclude from source control and click the Remove button (as for the .vsmdi file, it’s part of Visual Studio Team Test Files). IMPORTANT NOTE: This is for all projects on the TFS server.
- Assuming your Visual Studio solutions/projects are under TFS source control, in Solution Explorer select the specific file within your solution that you want to exclude from source control (as in, just click it once). On the VS menu click File, hover over Source Control, then click Exclude [Filename] from Source Control. After a second or two you’ll see the icon change next to that file indicating it is no longer under source control.
Oddly enough, there is no option (that I can find) in TFS that allows you to exclude specific file types from source control at the project level. It’s either at the server level for all projects or on an individual file basis within Visual Studio projects, but nothing in between (if anyone knows differently, please let me know).