visual-studio-2015tfs

TFS - An item with the same key has already been added


Needed to delete a branch in one team project so ran this command: tf destroy $/MyProject/Main/Bin /collection:http://servername:8080/tfs/myproject

The command completed but now when I open visual studio I get multiple errors with same message, saying

An item with the same key has already been added

Most solutions on SO recommend emptying out the cache folder under AppData which I've already done - does not help in my case. Now I cannot open any team project in my collection. All because I deleted one branch in one team project from command line!

error 1 error 2 error 3

And this operation never completes, stuck at "Working..."

waiting


Solution

  • Please try below ways:

    1. Make sure any instances of Visual Studio are not running, then delete all the caches files:

      C:\Users\username\AppData\Local\Microsoft\Team Foundation[version]\Cache C:\Users[username]\AppData\Roaming\Microsoft\VisualStudio\14.0\Team Explore

    2. Try to reset all environment settings:

      Tools > Import and Export Settings > Reset all settings

    3. Add a new workspace and map the sources to another location

      Go to "File"-> "Source Control" -> "Advanced" -> "Workspaces..."

    4. Try to run Visual Studio with another valid user by this command: (Navigate to C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE)

      runas /netonly /user: devenv.exe