Friday, April 10, 2020

How to delete workspace from TFS Visual Studio

Introduction:

In this blog, we will see how we can delete any of the TFS workspace which is assigned to different user

Even if tried to remove/delete the workspace from Visual Studio, We're unable to map existing workspace to new user.  

In such scenario, It is necessary to delete the workspace explicitly while getting the error as below 
"The working folder 'Workspace_Folder_Local_Path' is already in use by  the workspace : on computer 


Solution: 

1. Open Developer Command Prompt for VS2015 from Start menu

2. For getting the list of workspaces associated with user, run below command
tf workspaces /server:https://{TFS}.visualstudio.com/{CollectionName} /owner:"{Owner}"
Explanation, in my case {TFS} is xxxx.visualstudio.com/defaultcollection and {Owner} as Jagdish Solanki, Eventually it will look something like this,
tf workspaces /server:https://xxxx.visualstudio.com/{CollectionName} /owner:"Jagdish Solanki"
Reference:



3. To delete the workspace, run below command 
tf workspace /server:https://{TFS}.visualstudio.com/defaultcollection /delete "{Workspace};{Owner}"
It will looks something like this,
tf workspace /server:https://xxxx.visualstudio.com/defaultcollection /delete "SCM-DEV-1;Jagdish Solanki"
Once the above command is executed, system will prompt you if user has any pending change(s). Are you sure want to delete the workspace? (Yes/No). Enter yes
Reference: