Partager via


How to: Disable Multiple Check-out on a Folder?

There’s no direct way to do that. Multiple check-out is a property of a team project, it's not namespace specific. However, I can think of 2 alternatives using use the "Lock" feature, because that’s what TFS does when a team projects is set to exclusive check-out mode, it attaches a check-out lock for each pending change. Back to our alternatives:

1- You can ask users to check-out items with a check-out lock (they can do that using the Check-out dialog or the command-line). Or, if they already have checked-out items, they can still use the lock command to set a check-out lock on it. This will disallow other users to checkout the items.

2- You can write a program, for example something that can run in the background like a windows service, that subscribes to the VersionControlServer.NewPendingChange event and sets a check-out lock on the new pending changes. Please note that calling "lock" itself is pending a change, hence, the event handler is going to be invoked again, so you have to make sure that the code handles this case correctly, by ignoring it.

Either way, please do NOT use the /r option with the lock command, it's recursive by default if you set it on a folder.

Comments