How to Remove Workspace in TFS 2010-2018
A definitive guide to cleaning up old Team Foundation Server mappings
Have you ever encountered a "Workspace already exists" error or needed to clean up a developer channel mapping on a new machine? Dealing with stale Team Foundation Server (TFS) workspaces can be a headache.
This solution works for TFS 2010, 2012, 2013, 2015, 2017, and 2018.
The Solution: Visual Studio Command Prompt
The most reliable way to delete a stubborn workspace is through the command line tool provided with Visual Studio.
Step 1: Open the Command Prompt
Search your Start Menu for "Developer Command Prompt for VS 20XX" (where XX is your version) and run it as Administrator.
Step 2: Run the Delete Command
Use the following command syntax to delete the specific workspace:
tf workspace /delete /server:http://tfs.site.com:8080/tfs WORKSPACENAME
Example Scenario
If your user is sanjeebPC and your TFS server is located at
http://tfs.site.com:8080/tfs, the command would look like this:
tf workspace /delete /server:http://tfs.site.com:8080/tfs sanjeebPC
After hitting enter, you may be prompted to confirm. Type Y and press Enter.
Conclusion
Using the tf command line utility is a powerful skill for any .NET developer using legacy
TFS. It grants you control that the GUI often hides.