11

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.

riQQ
  • 9,878
  • 7
  • 49
  • 66
Martin Beckett
  • 94,801
  • 28
  • 188
  • 263

4 Answers4

11

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

James Reed
  • 13,873
  • 51
  • 60
  • I found the "delete the workspace" suggestion, but our hosted TFS implied that the entire company was "a workspace" - at least that's what it calls our entire collection. Is each machine+user a workspace? – Martin Beckett Feb 08 '13 at 18:07
  • ps thanks, the binary checkout/merge reason actually makes sense! – Martin Beckett Feb 08 '13 at 18:08
  • 1
    Each user can have many workspaces on many machines. A workspace is the mapping between a folder in source control and a folder on your local hard drive. Technically I suppose a collection can be thought of as a "workspace" as a general term, but in TFS workspace has a specific meaning. by default when you create a workspace its name is machineName;username, a second workspace on the same machine would be machineName_1;username you can rename the first part of the workspace name. Delete the old workspace and you'll be good to go – James Reed Feb 08 '13 at 18:17
  • thank you very much. Any idea on the other questions - Is TFS really so much less friendly than Git or do I just need to learn more? – Martin Beckett Feb 08 '13 at 19:41
  • That's quite subjective :-) I haven't used git that much so I can't really comment. TFS does take some getting used to and is very much a CVCS. A better comparison is SVN which I would say TFS is on par with (as of TFS 2012) from a source control point of view. Of course TFS does a lot more than version control. Whilst TFS has its flaws and annoyances, I would assert that it is 1 beeeeeeeelion times better than VSS – James Reed Feb 08 '13 at 23:15
  • Best answer ever. I have spent hours looking to unlock a check out that I did in another workspace/machine and until now, I was not able to. Thank you... – monn3t May 29 '21 at 03:57
3

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

riQQ
  • 9,878
  • 7
  • 49
  • 66
2

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.

Mockingbird
  • 1,023
  • 9
  • 17
0

I needed to change settings in 2 places:

  1. At Visual Studio, team project window, Settings->Team Project Collection -> Source Control enter image description here Enable File Merging for the extension.

2) At Visual Studio, team project window, Settings->Team Project -> Source Control enter image description here Enable the multiple check-out box

MiguelSlv
  • 14,067
  • 15
  • 102
  • 169