How to remove a TFS Workspace Mapping?

前端 未结 21 1957
深忆病人
深忆病人 2020-11-29 16:54

I had a project in tfs within a team project then we moved the project to a different location in another team project.

I had configured Jenkins to connect to the te

相关标签:
21条回答
  • 2020-11-29 17:41

    All of the answers here seem to be partial answers that don't work in all cases. I think this answer will work in all cases, assuming you have proper permissions.

    1. Open up the Developer Command Prompt. In my case, I've tested this with the Developer Command Prompt for VS 2019.
    2. Type this command: tf workspaces

    Note that the results can list a couple tables with identical structure. If you only see one table, then some of the assumptions in the other answers can work for you. However, if you see two or more tables, then that Collection string is important! For our examples, we're going to assume you have two Collections (two is no different than four other than one is more tedious than the other to go through it):

    https://dev.azure.com/foo and https://bar.visualstudio.com/

    With luck, you will know which one of these two you want to work with. However, if you need to cycle through them all, then you'll just have to do that one collection at a time. Each "Collection" here is the same as an "Organization" in Azure DevOps (I think).

    If you don't use this Collection detail, then you might see an error message:

    Unable to determine the source control server.

    1. Next, type this command for the collection you want to use:

    tf workspaces /computer:* /owner:* /collection:https://dev.azure.com/foo

    This will give you a much more complete picture of what you're dealing with. This gets especially nasty if you have had multiple MSAs and Org accounts hitting this repo from the same computer. In fact, you might have multiple seemingly-identical entries. If you try to delete them based on what you currently know, it may not work. But we can get more information.

    1. Next, we're going to run the same command but append /format:xml to the end of it:

    tf workspaces /computer:* /owner:* /collection:https://dev.azure.com/foo /format:xml

    This now gives you a bunch of XML with some additional properties. The ones that we likely care about the most are the Owner Aliases. This is the missing information you need to now go through and delete these workspaces. Without this additional information, it's easy to hit a wall and be stuck with an error message:

    Specify one workspace.

    1. Now we have all of the info we need. Given the additional OwernAliases entries, select the unique entry (or repeat if more than one) that you wish to delete and use this following command (a couple examples are listed):

      • tf workspace /delete /collection:https://dev.azure.com/foo "MyWorkspaceName;Windows Live ID\John.Doe@hotmail.com"
      • tf workspace /delete /collection:https://dev.azure.com/foo "MyWorkspaceName;John Doe"
      • tf workspace /delete /collection https://dev.azure.com/foo "MyWorkspaceName;2C3E8474-A39C-4785-8794-DC72F09981E6\John.Doe@Example.com"

    The GUID identifies an AAD directory and the quotes are there to handle any spaces that might be in an alias. The "MyWorkspaceName" comes from your previous queries listing out the workspaces.


    Without this very thorough approach, it's possible that all of the other answers in this question will fail for you. While some of those efforts will clear out local workspaces, they will not clear out server workspaces, which you can still conflict with. Additionally, if you have previously used a different account things can get hairy, like if you switched from an MSA to an AAD account. And things get REALLY hairy if you have an MSA account and multiple AAD accounts all with the same email address that you have used from the same workstation. And then it gets super crazy hairy if multiple of those all used the default name for the workspace: your computer's hostname. In my case, I had four workspaces all with the same Workspace name, Owner name, and Computer name (i.e. the first query without the XML formatting had 4 identical records!).


    I do not know if there's a more graphcial way to manage these than this. I have looked and not yet found a better way than this.

    0 讨论(0)
  • 2020-11-29 17:42

    Following are the steps to remove mapping of a project from TFS:

    (1) Click on View Button.

    (2) Open Team Explorer

    (3) Click on Source Control

    (4) Right click on your project/Directory

    (5) Click on Remove Mapping

    (6) Finally Delete the Project form local directory.

    0 讨论(0)
  • 2020-11-29 17:42

    If mapping is proper then you can undo/checkin your changes, if you really want to change folder name.

    Alternatively if you want to remove mapping then in Visual Studio go to File-> Source Control-> Advanced-> Workspaces-> Edit

    Now you can click on appropriate path and remove mapping.

    0 讨论(0)
  • 2020-11-29 17:43

    Follow these steps to remove mapping from TFS:

    1. Open team explorer
    2. Click Source Control
    3. Right click on you project
    4. Click on Remove Mapping
    0 讨论(0)
  • 2020-11-29 17:44

    First download and install Team Explorer plugin in your system and then go to the Source Control Explorer. In the navigation pane find the Workspace field and click on Workspaces option. After clicking on Workspaces option, you will see all the workspaces that are mapped. Click on the remove button and the remove the mapping for required workspaces.

    0 讨论(0)
  • 2020-11-29 17:45

    Finally deleted ALL workspaces and started from scratch. Fixed.

    0 讨论(0)
提交回复
热议问题