I mucked around with TFS settings and I accidentally included the bin and obj folders for TFS 2012 checkin, and even checked them in already. I don't want this because these files change often and aren't meant for inclusion.
I've checked What happened to "Exclude from Source Control" in VS2012. The accepted answer doesn't work because the bin & obj folders and the DLLs inside those folders don't appear in the "Promote Candidate Changes" list, even after excluding them. The second most popular answer also doesn't work permanently. I press yes to all and it removes them from the included changes list, but when I do any action involving rebuilding, they're added to include list again.
I'm looking for a permanent solution which will permanently exclude these folders and the files inside from checkin, and if possible also removes them from the TFS server.
TFS 2012 has the option to drop a .tfIgnore
file in your workspace.
Visual studio has a UI to create the file for you:
While you can manually create a .tfignore
text file using the above rules, you can also automatically generate one when the Pending Changes page has detected a change.
To automatically generate a .tfignore
file
- In the Pending Changes page, in the Excluded Changes section, choose the Detected changes link.
- The Promote Candidate Changes dialogue box appears.
Select a file, open its context menu, and choose Ignore this local item, Ignore by extension, or Ignore by file name.
Choose OK or Cancel to close the Promote Candidate Changes dialog box.
- A
.tfignore
file appears in the Included Changes section of the Pending Changes page. You can open this file and modify it to meet your needs.
- The
.tfignore
file is automatically added as an included pending change so that the rules you have created will apply to each team member who gets the file.
Or create it from the command line using echo . > .tfIgnore
and then open it using notepad.
Another trick is to name the file .tfIgnore.
in explorer and save it. You'll probably be prompted if you want to change the extension, the answer, in this case, is: yes.
For Excluding Bin folders ,Tick "Show Solution Changes" Under View options in "Included Changes"
I called in the help of our TFS admin.
We couldn't make a .tfignore file, but what did work was the following:
- Check in both folders in TFS;
- Delete the dlls and pdbs which are unique to the project from the source control explorer and check in this change.
- Rebuild the project locally, try to check in and confirm that there are no pending changes.
the dependent assemblies remain in TFS, but since these rarely change, this isn't a big issue.