Wednesday, January 12, 2011

Delete branch/subfolder in TFS

You don't use tfsdeleteproject for deleting a subfolder. You can use tf.exe command
Deleting a branch in TFS
Start .Net 2005/2008 command prompt:-
Start –> All Programs –> Visual Studio 2005 –> Visual Studio Tools –> Visual Studio 2008 Command Prompt

Ensure there is a workspace set up for the branch you want to delete and that a version of the branch has been fetched from TFS onto the local disk within the folder pointed to by the workspace.

In command prompt, change directory to the parent of the branch to be deleted. For example, if my workspace at the root level points to c:\projects and I have a branch called “TestMain” beneath it (c:\projects\TestMain) then do the following:-
> cd c:\projects
Then type:-
> tf delete /lock:checkout /recursive Reliable\CRM

If there are more folders under CRM, those will be marked for deletion if you specify /recursive switch.

Next:
Now, once you have specified what you want to delete, you have to check in your pending changes, which can be done like this

tf.exe checkin /recursive "A\B"

This should checkin your pending delete change and remove the folder from the repository and local workspace.

URL's:
http://www.woodwardweb.com/vsts/000143.html
http://nomisit.wordpress.com/2007/12/06/deleting-a-branch-in-team-foundation-server/