In order to delete a project, TFSDeleteProject uses a two-phase process. In the first phase, TFSDeleteProject iterates through the core areas of a project that have an IProjectMaintenance interface declared in the TFS registration data (i.e., version control, build, work item tracking, and core TFS services). For each such area, TFSDeleteProject calls the DeleteProject function that is associated with the IProjectMaintenance interface. It is possible to find more detailed information about which the services support the IProjectMaintenance interface by calling the GetRegistrationEntries method. For more information, see IRegistration.GetRegistrationEntries Method.
More specifically, the first phase of TFSDeleteProject affects the components of a project the following manner:
- Version Control
-
Uses a two-phase delete process. First, all version control information associated with a project are flagged to be deleted. Next, at a later point in time (typically midnight), the TFSVersionControl Administration job is run on the SQL server to delete all the flagged data. Until this job is run, a user cannot create a project with the same name. In order to force the TFSVersionControl Administration job to run immediately, see How do I start or view the history of the TFSVersionControl Administrator job?.
The second phase is not automatically executed because it may take a long time to complete, and when it is executing, it reduces the quality of service of current users when executing.
- Build
-
Deletes all test results, build data (including information and core data), build definitions, and build agents associated with the team project. The build drop locations are ignored. For team projects, it is possible that the build component will time-out. If this occurs, increase the time-out time and call TFSDeleteProject again. For more information, see the section How do I modify the DefaultTimeout value? in this article.
- Work Item
-
Deletes all work items and work item fields that belong to a project plus any metadata that is not shared. As with the build component, for team projects, it is possible that the WI component will time-out. If this occurs, increase the time-out time and call TFSDeleteProject again. For more information, see the section How do I modify the DefaultTimeout value? in this article.
In its second phase, TFSDeleteProject deletes the remaining areas (i.e., the SSRS reports and the WSS site) using their built-in interfaces. The URLs that TFSDeleteProject uses to locates the built-in interfaces for the SQL Server Reporting Services and the Windows SharePoint Services can be configured by the tfsadminutil ConfigureConnections command. For more information, see ConfigureConnections Command.
The distinction between each phase is important because there are different consequences depending on which phase TFSDeleteProject fails. If the first phase fails, the project node will remain in Team Explorer and you can retry the deletion process by invoking TFSDeleteProject again. If the first phase succeeds and the second phase fails, project node will disappear from Team Explorer even though the SSRS reports or the WSS site may remain. Thus, in this case, in order to completely remove this project, the remaining SSRS reports and WSS site must be deleted by hand instead of invoking TFSDeleteProject again. For more information, see Resolving Failures earlier in this article.