8

I am searching for a possibility to exclude some files of my generated VS project file from TFS. I know that it is possibly afterwards with the .vspscc file.

But what i want is, that i can tell the VS project file, that some of it's files are not allowed to get added to TFS, before I add the project to TFS.

Tunaki
  • 132,869
  • 46
  • 340
  • 423
bobschi
  • 325
  • 1
  • 3
  • 13

2 Answers2

12

There are several levels of excluding files in TFS:

  1. Manually by excluding a file or folder on the check-in dialog.
  2. Manually by excluding a file or folder on the Add items to Folder dialog. tfs scm exclude manually
  3. On the Add items to Folder dialog > Automatically exclude from source control: tfs exclude
    Note: the default items can be modified using the registry.

  4. On the team project source control level using a check-in policy.

  5. On the source control permissions level: Source Control > Mark a folder > Security > Deny Check-In permission tfs scm permissions
  6. On the workspace level by cloaking.
Community
  • 1
  • 1
KMoraz
  • 14,004
  • 3
  • 49
  • 82
  • Okay maybe if have to explain a bit more. I have a tool, which generates a complete solution (I have to change this tool). This solution is added to TFS. But when adding, these specific files should not be added. So is there a way to mark this files before adding to TFS. – bobschi May 22 '12 at 12:38
  • Does the solution is being generated with a script or some blackboxed application? Does it being added to TFS automatically or by the user? – KMoraz May 22 '12 at 15:15
  • See updated answer. In this case I think options 1-3 applies for you. – KMoraz May 24 '12 at 14:11
  • Let me not agree with KMoraz. I would first explore extending the tool to perform some of the tfs operations - make it pend add on the correct files or update workspace with cloaks. I would recommend first approach – MichalMa May 24 '12 at 19:27
3

Not sure about the accepted answer by KMoraz. #1 and #2 don't seem to be permanent, #3 doesn't even appear for me (I'm using VS2012), #4 and #5 require permissions (which I don't have on CodePlex) and #6 is not even relevant (because you cannot cloak something that isn't first checked-in).

I know your question is about BEFORE they are added, but I think the answer, which is to create a ".tfignore" file, only works for TFS 2012.

For me I had to locate the ".vspscc" file (which I know you already stated) in the project folder and look for this line:

"NUMBER_OF_EXCLUDED_FILES" = "0"

In my case I wanted to exclude TypeScript generated files, so I added this:

"NUMBER_OF_EXCLUDED_FILES" = "3"
"EXCLUDED_FILE0" = "app.js"
"EXCLUDED_FILE1" = "app.js.map"
"EXCLUDED_FILE2" = "app.min.js"

I really hope they get their head on straight and add the feature you're looking for to VS in a more accessible way.

... and yes, there's a menu for excluding files in "File->Source Control->Advanced", but it should be in a context menu, and it doesn't apply to NESTED files (such as the app.* ones above [for .ts files]).

James Wilkins
  • 6,836
  • 3
  • 48
  • 73
  • Worst yet, it's not even working for me. I've excluded the file from source control as described, but any changes to that file cause it to reappear in "Pending Changes" – Mister Oh Aug 20 '14 at 21:06