How can I always block checking a specific file in TFS

There is one file that I have always made changes to, but I never want to be checked. I would like TFS to block me from checking or making changes. How to configure TFS for this?

More: There is another developer in the project who checked in some bad code, which I prefer to comment on my local machine. Since they are a client, I prefer to keep this technical exercise rather than make it political.

+60
tfs
Mar 16 '12 at 17:38
source share
8 answers

One of the underrated features of TFS is cloaking . Like SVN ignore , cloaking allows you to ignore a specific folder or files.

Filling in the folder

Folder smoothing is easy: just right-click the folder in the version control explorer and select Cloak

File shading

The user interface does not disclose cloning in a single file, but sometimes you may need to hide a specific file, such as app.config .

  • Go to File > Source Control > Workspaces

  • Select a workspace and click Edit .

  • Under the working folders and the new entry with the status Cloaked and enter the full path to the file of the file that you want to hide. (For example: $/MyTeamProject/Dev/Src/SomeProject/app.config )

Cloaking a file




Using the local workspace .tfignore file (in TFS 2012, 2013, 2015 and above)

In Local Workspace , use the .tfignore file (equivalent to .gitignore for Git)

 .tfignore file example ###################################### # Ignore .cpp files in the ProjA sub-folder and all its subfolders ProjA\*.cpp # # Ignore .txt files in this folder \*.txt # # Ignore .xml files in this folder and all its sub-folders *.xml # # Ignore all files in the Temp sub-folder \Temp # # Do not ignore .dll files in this folder nor in any of its sub-folders !*.dll 

Permission Lock

Another approach is to refuse to register a file (administrative privileges are required):

  • Right click file> click Properties > Security

  • Add your user and mark Deny in Check In permission.

Deny check in

+85
Mar 16 '12 at 18:53
source share

For TFS 2012, just use the .tfignore file.

When adding ignored files to folders that are displayed in the local workspace, they do not appear on the Pending Changes page in Team Explorer.

http://msdn.microsoft.com/en-us/library/ms245454.aspx

+12
Dec 02 '13 at 20:10
source share

Visual Studio 2013 (and 2012)

This function is available by selecting a file and go to:

 File > Source Control > Advanced > Exclude ... from Source Control 
+8
Feb 23 '14 at 3:50
source share

There are two ways.

  • You can Undo it in the Pending Changes window, then it should keep this in mind the next time you load Visual Studio. This is a little cumbersome if you like "select all" and "Check / uncheck" in the list and error.
  • Do not check the file, go to Explorer and delete the Read-Only attribute yourself. Then edit the bits you need. The caveat is that TFS is unaware of this and does not always correctly update the file. In addition, if you edit this file in VS (to change the anoter), it will be "written out" and you can check it by mistake.

I don’t like any option in TFS / VS 2010, so I actually avoided doing this (I had a lot of “ignore on commit” when we used SVN). Now I am using VS11 Beta, the Excluded list does exactly what I want, I move something to it and it stays there, and I can easily make other changes to this list and disable it, rather than checking this file.

+3
Mar 16 '12 at 18:00
source share

You can simply exclude a file from Source Control

1. Select a file in Solution Explorer

2. Go to File → Source Control → Advanced

Path to exclude

and here

Here is the Exclude

+3
Sep 26 '14 at 8:22
source share

Another option is to use a custom registration policy. You can create your own or use the Prohibited Policy Templates from TFS 2010 Power Tools . Of course, you need to be a TFS administrator to install it, and this may not be what you need in your situation. You can also override any validation policies.

+2
Mar 17 '12 at 19:52
source share

if you use the "Local" workspace type, which is new to TFS 2012, your files with a controlled source are not set to read-only. But in this case, no matter where you edit them, they are visible to TFS as changed and are included in pending changes. It would be great if the "auto-exclude" option from the pending changes was selected by default. And turn them on only when you want it.

+2
Apr 19 '13 at 13:51 on
source share

Hidden folders are never detected as a TFS change using this function if you are using VS2010. A folder in which you do not want to be part of TFS Mark it as hidden.

+1
Jun 03 '16 at 9:31 on
source share



All Articles