Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TFS file must remain locked

Tags:

tfs

tfvc

I have some 3rd party dlls checked into TFS
Our machines were renamed and now TFS believes they are checked out for edit by me on another machine.

I tried tf lock /lock:none contrib64/* /workspace:oldmachine;myusername but I get the error

TF10152: The item $/XXX/YYYY/contrib64/third_party.dll must remain locked because its file type prevents multiple check-outs.

1, Is there any way around this ?
2, Is TFS really this bad or is it just me ?
3, Is the purpose of TFS to make us nostalgic for VSS?

ps It's a hosted version so I can't just get the admin to fix it.

like image 294
Martin Beckett Avatar asked Feb 08 '13 16:02

Martin Beckett


3 Answers

Undoing the lock won't work on those files because they are binary, as binaries cannot be merged they must be locked if they are checked out.

As the machine the workspace resides on no longer exists (the machine has been renamed) the best thing to do is delete the workspace.

from a Visual Studio command prompt

tf workspace /delete oldmachine;myusername /collection:http://*tfsserver*:8080/tfs/*collection*

This will remove the workspace and undo all pending changes

like image 154
James Reed Avatar answered Oct 15 '22 20:10

James Reed


If you don't want to delete the workspace, you can undo the change and unlock the file after that:

Using a Visual Studio developer command prompt:

tf undo "$/<server-path-to-file/folder>" /workspace:"<workspace>;<user>" /collection:<collection-url> /recursive

tf lock "$/<server-path-to-file/folder>" /lock:none /workspace:"<workspace>;<user>" /collection:<collection-url> /recursive

like image 29
riQQ Avatar answered Oct 15 '22 20:10

riQQ


Files with .dll extension as well as other extensions like .exe, .doc, .docx, etc. are automatically locked because (as mentioned) here they cannot be merged.

If you want to disable the automatic lock and allow these files to go through gated check-in, follow the steps below:

  1. Log in to your build server.
  2. Open visual studio.
  3. In team explorer, log into your team project.
  4. Go to "Settings".
  5. Under "Team Project Collection", select "Source Control".
  6. Set "File Merging" property to "Disabled" for any file extension you don't want to be automatically locked.

Reference: https://blogs.msdn.microsoft.com/phkelley/2008/11/12/everything-you-ever-wanted-to-know-about-locks/

This worked for me.

like image 29
Mockingbird Avatar answered Oct 15 '22 20:10

Mockingbird