Friday, June 22, 2007

Deleting a workspace pointing to a server that is no longer

June 2007 - During the last year or so we've had a number of TFS servers up and running. The first server was a "proof of concept" server that ended up expiring on us right before a demo. Microsoft was nice enough to give us an extra 30 day extension on the 120 day trial license, but after 150 days of running TFS (both AppTier and DataTier) on an old desk top machine, we had had enough of it.

Our next TFS instance was for the "pilot," and to be honest it was not much better. In fact performance might have been worse (not due to TFS though). It did however fulfill our pilot needs and got the TFS product approved by upper management. Once we purchased TFS, we bough a bunch of bulky hardware and have it all under tight control in our datacenter. We also ditched our "pilot" TFS box as the one gig of RAM was giving me heartburn. Enough about our old TFS instances though.

Just yesterday I was trying to setup a workspace and got the error "The remote name could not be resolved: 'F1-777-2KA'" This perplexed me as 'F1-777-2KA' was our pilot server that the local system administrators took off to the graveyard a few months back. Then I remembered that I must have had a workspace from the old pilot machine that is stuck in my local cache. Sure enough issuing the command 'tf workspaces' showed the old workspace pointing at a machine that was no longer in existence. I'll just delete it right? Wrong!

Logically, I issued the command 'tf workspace /delete TestMainline' thinking I could delete the workspace from my cache. The command returned the error "The remote name could not be resolved: 'F1-777-2KA'" Sure it can't. The machine is retired in some garbage heap.

After digging around I found Buck's post which lays the solution out for us. Simply open the 'VersionControl.config' file which for me was under 'C:\Documents and Settings\%USERNAME%\Local Settings\Application Data\Microsoft\Team Foundation\1.0\Cache' and delete the invalid <ServerInfo> element. Below is what I had to delete. Good luck deleting your workspaces!

<serverinfo uri="http://F1-777-2KA:8080/" repositoryguid="0544w34a0-6cb2-498c-a64c-8ae38a6575657">

<workspaceinfo comment="" computer="U0000001-XPB" name="TestMainline" ownername="Domain\U0000001" lastsavedcheckintimestamp="0001-01-01T00:00:00Z">

<mappedpaths>
<mappedpath path="C:\anthill">
<mappedpath path="C:\tmp\ant_test">
</mappedpaths>

</workspaceinfo>

</serverinfo>

3 comments:

Buck Hodges said...

I'd really advocate using the command "tf workspaces /remove:* /s:http://F1-777-2KA:8080/" (mentioned in the post you reference) rather than editing the versioncontrol.config file by hand. That command will not attempt to contact the server, and it's designed to handle situations like what you ran into. While there's nothing magical about that command, it'll avoid any headaches from XML syntax errors.

Buck

Mac Noland said...

Understood Buck. Thanks for the feedback.

Chris G. Williams said...

This saved my day. Thanks!!