What do you do if the file in TFS is locked by someone else?

Viewed 65697

Someone left the organisation but before leaving, he locked all the files for an unknown reason.

How do you unlock them all so that the other developers can work?

12 Answers

For the following operation, you will need to be either a project administrator for the project you want to undo the check-in on or a Team Foundation Administrator if you want to do this across all projects.

If you still have the username of the person, you can simply do something like this:

  • Open up Visual Studio command prompt (Start -> Programs -> Microsoft Visual Studio 200X -> Visual Studio Tools -> Visual Studio 200X Command Prompt)
  • Run the following command:

tf lock /lock:none /workspace:WorkspaceName;USERNAME /recursive $/

To get the list of workspaces for a user, just run the following command from the same prompt:

tf workspaces /owner:username

For more commands, check tf /?

If the developer has left the organization, then the best thing to do is to delete their workspaces. This will unlock the files for you but also free up some resources on the server.

See the following blog post I did on the topic when it happened to me a few years ago.

http://www.woodwardweb.com/vsts/unlocking_files.html

You can either delete the workspace using the command line (tf.exe) or you can use the excellent TFS Sidekicks from Attrice.

Here's an explanation of using TFS permissions.

Having the "Unlock other user's changes" permission set to Allow is required to remove a lock held by another user.

Have a system administrator reset that users password, log on as that user, unlock all files...

I would think this is the solution to almost all 'someone who is no longer at this organization' questions...

Method that worked for me, my account has administrator permission on TFS and project :

In Visual studio 2015:

  1. Go to Team Explorer
  2. Click right on your solution and choose Open in source control exporer
  3. On left side click right on your solution
  4. Choose Advanced
  5. Choose Lock...
  6. On left side click right on your solution
  7. Choose Advanced
  8. Choose Unlock (Now you can choose unlock)

Right now, every dev can easily commit his changes :)

by using TFS permissions, Open up Visual Studio command prompt,Run the following command:

tf undo /workspace:workspaceName;DomainName\UserName  $/file path in your solution
Related