Saturday, November 28, 2009

How to Delete a Project from TFS 2008

This method deletes entire projects and all its dependents. This includes Build information, Work Items, Version Control, Report Server files and the SharePoint site. This will NOT delete anything that is shared with another project however.
On the App Tier of TFS; open a command prompt to the following location:
C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE
From here you will run a tool called TFSDeleteProject.exe. The parameters required are the TFS App Tier name and the Project name that is being deleted. The following is an example of the syntax:
C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE>TFSDeleteProject /server:<AppTierServer> "ProjectName"
You will get a warning asking if you are sure about deleting the project; press “Y” and enter which will start the process of deleting the project and its dependencies. The process can a while depending on the number of items the particular project contains in version control and number of work items.

UPDATE:
Please make sure you change the Instance ID on any restored system!  To learn more about this; check out Buck Hodges blog and post on this topic
Instance ID and the Visual Studio caching put me in a most awkward situation where I ended up deleting the projects from the wrong environment.  Oops!

How to change the TFS 2008 Instance ID

The Instance ID is a GUID that is used to identify a TFS Server in a unique manner. This becomes problematic when restoring an existing TFS system to new hardware, creating a development environment of TFS and disaster recovery of an existing system. It stems from a client side problem when communicating with the TFS App Tier in a file called “ServerMap.xml” in the user’s profile directory. This should be run each time TFS is restored in the aforementioned scenarios. (Remember: You should be an Administrator in both Windows and Team Foundation Server)
On the App Tier of TFS; open a command prompt to the following location:
C:\Program Files\Microsoft Visual Studio 2008 Team Foundation Server\Tools
Next you will run the commands replacing <DataTierServer> as appropriate:
C:\Program Files\Microsoft Visual Studio 2008 Team Foundation Server\Tools>InstanceInfo.exe stamp /setup /install /rollback /d TFSWorkItemTracking,TFSBuild,TFSVersionControl,TFSIntegration,TfsWarehouse /s <DataTierServer>
C:\Program Files\Microsoft Visual Studio 2008 Team Foundation Server\Tools>InstanceInfo.exe stamp /d TFSWorkItemTracking,TFSBuild,TFSVersionControl,TFSIntegration,TfsWarehouse /s <DataTierServer>
This completes the task of changing the Instance ID. This will now resolve any issues with clients accidentally trying to communicate with the original server name.