Search code examples
command-linetfstf-cli

TFS command for switching workspace


Is there a command to switch the active workspace from tf.exe ?
I have searched here and here.
But I do recall, I've seen it some time ago.


Solution

  • If you just want to change a workspace, you could not be able to do this through tf.exe command line. You should active you workspace window in Visual Studio:

    • In Visual Studio,click Source Control Explore.
    • From the Workspace dropdown select "Workspaces..."
    • The Workspace window appears
    • Click the WorkSpace name in Workspace window
    • From the popup list choose the Workspace name you want.

    If you want to modify/update the workspace mapping, you could use tf workfold command, sample as below:

    c:\projects>tf workfold /collection:http://servername:8080/tfs/collectionname /workspace:workspacename  $/projects/project_one C:\DifferentWorkfold
    

    The above example maps the folder C:\DifferentWorkfold to the Team Foundation version control server folder $/projects/project_one and replaces the previous workspace mapping for the $/projects/project_one Team Foundation version control server folder.