Unlocking TFS Version Control items

We have a Visual Studio solution that uses some external assemblies coming from third parties. This solution resides in TFS 2010 version control. We have configured Team Foundation Build to do automatic builds of the solution. As you know you should put any external assemblies in TFS Version Control to do a proper build without any build breaks. So we did same. Whenever we want to update the assembly with a new one, we first check-out the item, copy newer assembly to local folder and then check-in it again.

An assembliy (.dll file) in TFS can not be checked-out by multiple users because it’s a binary file and can’t merged or compared. Just like files of type gif. We had a situation recently that a user checked-out one assembly without checking-in it again or undoing his change. As he went to vacation, that assembly remained locked in TFS version control and no one could check-out that assembly again. Me as TFS administrator was forced to unlock it. So googled for the solution and found Martin Woodward’s work-around:

tf lock $/MyProject/MyPath/MyFile.cs /lock:none /workspacename:WorkSpaceName /server:my_server

Unfortunately this was not working for me because I got error:
Tf10152: the item xxx must remain locked because its file type prevents multiple check-outs.

I was very hopeless but another link showed me how to use “undo” to solve my problem. This time it worked nicely:

tf undo /workspace; /server:  item

For those unfamiliar with “tf”, it is powerful command-line tool for TFS that can be run from a “Visual Studio Command Prompt” window.