David Brenchley
David Brenchley

Reputation: 86

Computer renamed - TFS Workspace doesn't work now

Had to change my computername and domain. Now I can't access team foundation. I tried this statement to fix it.

tf workspaces /updateComputerName:MyOldComputerName /s:"http://MyServer/MyCollection"

It didn't work. I get the following error "Key not valid for use in specified state."

Not sure what to do now.

Upvotes: 0

Views: 1723

Answers (1)

Jason Williams
Jason Williams

Reputation: 57952

It sounds like you may have a problem that will prevent remapping the workspace. However, it's possible that the command isn't quite correctly formed, so try checking the collection URL (I'd expect it to include MyServer:8080), and in versions of TFS 2010 onwards the documentation refers to /collection: rather than /s:

If that fails, then one approach to rescue things is to create a new workspace and delete the old one. You can transfer any edited files you had checked out to the new workspace as follows:

  • Rename your old source code folder, so you keep a backup
  • Create a new workspace that maps the (old) source code folder location, and Get the latest version of the code.
  • If you think you deleted or added files, use a folder-diff utility to find them, and manually re-do those changes.
  • Now check out everything (right click on the root folder and check it out)
  • Copy your backed up source code over your workspace folder
  • Undo checkout on everything. Visual Studio will ask if you want to discard your changes. Carefully choose the "No to all" option. This means it will only discard locks on unchanged files.
  • You will now have all changed files listed in your pending changes.
  • Once you're absolutely sure this has all worked, you can delete your backup of the source.

(You can achieve a similar thing by unplugging your network cable to force Visual Studio to go offline, moving your old source code back in place of your new workspace folder, then plug the net cable back in and using File > Source Control > Go Online. This should diff your code to the server and work out what changed. I don't trust this as much as the above approach though)

Once you have the code in your new workspace, you can use the tf command to delete the old workspace to clean everything up.

Upvotes: 1

Related Questions