Delete a locked file in TFS

By jpsmit
January 24, 2008

This is more or less a note to self because I probably will run into this again.

Today I was cleaning up the code tree in TFS and found a project that could be deleted. Unfortunately the developer left the company leaving a file checked out. With the Source Control Explorer it wasn’t possible to remove the project as long as there were locked files. The file status is stored in the workspace, so deleting it would solve the problem

Using the TF.exe commandline tool it was possible to lookup ad delete that workspace.

Getting the workspace name:

tf workspaces /owner:<developers_logonname> /computer:* /server:<your TFS server>

Deleting the workspace:

tf workspace /delete /server:<your TFS server> workspace_name;developers_logonname

Remember that you need AdminWorkspaces global permissions to be able to delete the workspace.


Comments: 0

Leave a Reply

Your email address will not be published. Required fields are marked *