Deleting a Team Project
Deleting a Team Project permanently removes data associated with that project from the database. The data cannot be recovered later. Therefore, you should save Team Project data that you might want to access later. In this recipe, you'll learn how to delete a Team Project using the TFS Admin Console and the command line. We will also review the difference between the two approaches.
Getting ready
In order to delete the Team Project, you should be a member of the following groups:
- Team Foundation Administrators group
- SQL Server Administrators group
- Farm Administrators group for SharePoint products (this is only required if TFS has been configured to integrate with SharePoint)
In this recipe, we'll review the two available options to delete a Team Project. The first option is to delete it from the TFS Admin Console, and the other option is to delete it from the command line. When a project is deleted from the admin console, any associated reports and SharePoint portal projects need to be manually deleted. The TFSDeleteProject
command-line tool deletes all artifacts.
How to do it...
Option1
First let's look at how to delete the Team Project from the Team Project Administration Console:
- Log into the server that hosts your Team Foundation Application Tier.
- Open the Team Foundation Administration Console window and, from the left panel, click on Team Project Collections. Click on the Team Projects tab to see projects in the default collection:
- Select the Fabrikam Team Project and click on Delete:
- In the Delete Team Project window, select Delete external artifacts and Delete workspace data. Click on Delete button to continue.
- The deletion workflow is triggered, flip to the Status tab to track the progress:
- While all links to the project portal will be removed from Team Web Access, the SharePoint site that acts as the portal will need to be deleted manually from SharePoint Central Administration.
Option 2
Now, let's look at how to delete the Team Project using the tfsdeleteteamproject
command-line tool:
- Open the Visual Studio 2015 Command Prompt. Alternatively you could open up a command prompt and change the directory to
%programfiles(x86)%\Microsoft Visual Studio 14.0\Common7\IDE
. - Run the following command:
tfsdeleteproject /q /force /collection:http://tfs2015:8080/tfs/ Fabrikam
The command-line utility offers a few more switches:
/q
: This is an option switch; it enforces quite mode wherein no prompts are raised for confirmation during the deletion process./force
: This is an optional switch; it enforces that the deletion process should continue even if some components cannot be deleted./excludewss
: This is an optional switch. If you do not want to delete the SharePoint site associated with the Team Project, use this switch.
How it works...
The tfsdeleteproject
command carries out the deletion in two phases. The first phase deletes the project data that includes data in version control, build and test manager, components of the Team Project in Team Explorer, Work Items, and any Work Item fields that exclusively belong to the Team Project. The next phase deletes the project websites. This includes any reports associated to the Team Project as well as project portals on SharePoint.
Note
If you try to access a Team Project that has been deleted, you are likely to get this error message. TF200016: The following project does not exist. Verify that the name of the project is correct and that the project exists on the specified Team Foundation Server.
The following data may remain undeleted when using tfsdeleteproject
:
- Team Project data in the cube: The Team Project data in the cube will only be removed with the next rebuild. The default rebuild for the warehouse is set to 2 hours.
- Build drop files and folders: Build binaries, build log files, and log files containing test results are published during the build process. The locations for these files are not deleted. These files need to be manually removed from the folder locations.
- Shared Work Item tracking metadata:
tfsdeleteproject
does not delete any metadata for Work Item tracking that is shared between Team Projects. - Version control shelvesets containing shared code: Version control shelvesets are not deleted if code in the shelveset is from multiple Team Projects.