Monday, March 03, 2008

Prevent Shared Checkout in TFS

Preventing shared checkout is possible in Team Foundation Server for specific file types. By default, binary files (such as executables, Word documents etc) can't be merged and so the option will be disabled. Whether you have merging enabled for source code is really an opinion piece. Merging can be really powerful, but if your developers tend to make wide ranging changes in each changeset, it can begin to bog you down in merge management.

To change the merging settings for a particular file type, open Visual Studio 2005 and select Team | Team Foundation Server Settings | Source Control File Types. This dialog controls the settings for the server, not an individual project.

image

Select the extension you wish to change (in this case cs for C# files), click Edit and uncheck the Enable file merging and multiple check out checkbox.

image

Click OK, then OK again and you should be set. Apparently even though when you check out a file from Visual Studio, the Allowed Check Out option is still there - the back end just ignores this setting. If you attempt to check out an already checked out file, you will get error TF10151: Cannot lock item XYZ for check-out.

No comments: