Main Page
 The gatekeeper of reality is
 quantified imagination.

Stay notified when site changes by adding your email address:

Your Email:

Bookmark and Share
Email Notification
TFS 2008 and Deleting A Team Project
    Looking For Team Foundation Server 2008 Tutorials? Go here.

Purpose
The purpose of this tutorial is to demonstrate how to delete those team projects that are not needed anymore, like those n00b team projects that are created when you are just trying to figure out how to use TFS 2008 when you get your hands on it for the first time. One would think, when first starting out, that you would be able to just right-click on the team project name in Visual Studio 2008 in either the Team Explorer pane or the Source Control Explorer window because your account has full control over the team project. As it turns out, that is NOT necessarily the case. I found out that as far back as 2005 TFS was purposefully designed so you could not delete a team project that easily (you could remove the team project name from the Team Explorer pane itself but that does not actually get rid of it).


But, even if you are a server administrator for the TFS server box, you may not have the permissions needed to delete the team project using the command-line tool "tfsdeleteproject.exe". If you can't delete the team project initially by using the command-line tool, adding "/force" to it will not change anything. This tutorial will take you through the whole process in such a case so that team projects can actually be deleted.

STEP 1

(Enlarge)
  1. A team member (one which has full control over the team project "test4") attempts to delete "test4" from Visual Studio 2008
  2. The team member finds that it is easy to remove "test4" from the Team Explorer window. The only problem is, it does not disappear from the Source Control Explorer window
  3. The team member attempts to delete the project by right-clicking on it from the "Folders" pane of the Source Control Explorer window only to discover that the delete option is greyed out
  4. You, as the TFS server administrator, are called in to remove that team project
STEP 2

(Enlarge)
  1. You try to remove the team project since you heard of "tfsdeleteproject.exe", a command-line tool
  2. You access the TFS 2008 Server box itself as the server administrator
  3. From the command-line you go to: Program Files\Microsoft Visual Studio 9.0\Common7\IDE
  4. You run tfsdeleteproject /server:TFS test4 where "TFS" is the name of your TFS box and "test4" is the name of the team project that you want to remove
  5. You confirm that you want to really delete the team project
  6. You get the error "You are not authorized to access..."
STEP 3

(Enlarge)
  1. The account that you logged into the TFS 2008 Server with (even if it may have server administrator-level priviledges on the server box itself, it is not necessarily recognized as having sufficient permissions with TFS or SharePoint which tfsdeleteproject.exe interacts with)
  2. So, what you need to do is to add the account to the Team Project that you want to delete
  3. You need to get into SharePoint Services. Type in "http://tfs/Sites/test4/_layouts/user.aspx" where "tfs" is the name of your TFS box and "test4" is the name of the team project you want to remove
  4. You should get an error message as shown
STEP 4

(Enlarge)
  1. Click on the text link "Sign in as a different user"
  2. Login with the TFS Service Account
STEP 5

(Enlarge)
  1. After logging in, for the team project "test4" you will see a Permissions page
  2. While the user who created the team project "test4" inside of Visual Studio 2008 (on their local computer) is listed as having full control they, by default cannot delete the team project they created inside of Visual Studio 2008. You probably don't want to give them permissions to the TFS Server box either
STEP 6

(Enlarge)
  1. In order to add the account you use to login to the TFS Server box, click on "New"
  2. From the drop-down menu select "Add Users"
STEP 7

(Enlarge)
  1. Enter the name of the account that you logged into the TFS Server box with (which has the permissions to execute tfsdeleteproject.exe)
  2. Click on the button labeled "OK"
STEP 8

(Enlarge)
  1. The account should be added to the users/groups of the team project "test4"
STEP 9

(Enlarge)
  1. Run tfsdeleteproject /server:TFS test4 where "TFS" is the name of your TFS box and "test4" is the name of the team project that you want to remove


Some Final Notes
If team members still see the team project that you deleted (remember, they may have a local copy on their computers) they will need to get the latest version of what is available and refresh the list of team projects that actually exist on the TFS server. As well, the team project that you delete may get triggered in SQL as a job that gets run (default is midnight) wherein the data contained in the SQL database will not be removed until that job is run. The good news is you can enter into the SQL Server Management Tools and manually start the job so the deletion happens faster.

Finally, you can hide a team project (if you don't actually want to delete it) from the Source Control Explorer window that client computers see. This is done by logging into the TFS server box and, as the project or server administrator, navigating to one of the mappings and entering:

tf permission /deny:Read  /group:[TEAMPROJECT]\tfsadministrators  $/test4 /server:TFS   


tfsadministrators - the group, as defined in TFS 2008, that you don't want to be able to see the team project
test4 - team project name
TFS - TFS Server name
About Joe