If you are using Team Foundation Server, you definately have been in the situation that you want to delete a Team Project. Perhaps because it’s obsolete because you moved all branches to another Team Project.
To delete a Team project, you have two possibilities. The manual command-line way, or using the TFS Administration Console.
1. The command-line way
You can delete a Team Project using the TFSDeleteProject command. To use this command, open your Visual Studio Command Prompt, enter this: ‘TFSDeleteProject‘ and press enter. If you see the information about the command, you’re good!
First of all, keep the following in mind
- Be sure you are a member of the Team Foundation Administrators security group or a member of the Project Administrators security group.
- Know what you are doing!
- Take a back-up of all your important data as there is no way back (or you have to restore the latest backup from TFS)
TFSDeleteproject [/q] [/force] [/excludewss] /collection:URL TeamProjectName
- /q = Optional: Use the quiet mode. Do not prompt the user for confirmation.
- /excludewss = Optional. Specifies to not delete the SharePoint site that is associated with the team project. Specify this option to maintain the existing site so that other team projects can continue using it.
- /collection:url =Required. Specifies the URI of the team project collection.
- /force = The program should continue even if some parts cannot be deleted.
Ok, let us assume that we want to delete ‘ProjectToRemove’.
Enter the following command in the Visual Studio Command Prompt
TFSDeleteproject /force /collection:http://luna:8080/tfs/Cognistreamer ProjectToRemove
In my case, the team project is located in the CogniStreamer collection. If you execute this action, you will be warned about the fact that this is an irrecoverable operation. Enter ‘Y’ to continue.
2. TFS Administration Console
The next possibility is to use the TFS Administration Console. You can open the console using ‘Start – All Programs – Microsoft Team Foundation Server 2010’
Open the Application Tier node and select Team Project Collections. Select the correct collection, en select the team project you want to delete. Next step is to click ‘delete’.
In the next dialog, you can select to delete all external artifacts (like SQL Server reporting services, labmanagement) and to delete all workspaces related to this team projects.
This should do the trick!
Ony one remark, from what I experienced, you can only delete the sharepoint site using the command line approach (or exclude the removal using /excludewss). But in the TFS Administrator console, you can only delete the external artifacts and workspaces, but NOT the Project Portals..