Search code examples
visual-studiotfsworkspace

Change mapping for TFS Workspace on PC with the same name


I have a returning user that had a laptop last year who had mapped a TFS workspace on it. This year he has returned and has a new laptop, but the computer name has stayed the same. When trying to map branches to his S: drive, he get's the following error:

the working folder S:... is already in use by the workspace COMPUTER1 on computer COMPUTER1

As noted, his new computer is also named COMPUTER1

I've tried running the following from the new workstation:

tf vc workspaces /computer:NEWCOMPUTERNAME /collection:CollectionWhereWorkspaceExists /updateComputerName:OLDCOMPUTERNAME /login:USER.NAME WORKSPACENAME

Any thoughts on how to get through this, avoiding renaming the PC? If it comes down to it I'm sure we could do that.


Solution

  • Since both computers are using the same computer name, tf workspaces command may not work properly.

    Besides that specific workspace on old computer maybe already in an invalid status.

    You could directly delete the unused old workspace. First use below command to list detail info for all workspaces:

    tf workspaces /computer:* /owner:* /format:xml
    

    With info of owner uniq ID

    Then you just need to use tf workspace /delete the command, in my sample it’s using:

    tf workspace /delete ws_3_3;fb46f066-9122-4342-94c4-93b7526a3545
    

    More detail info please refer my answer in this link: Azure Devops - Deleting Workspace

    Finally, create a new workspace on the new computer and establish mappings from server side.