Removing a Project from the Server


There will be circumstances where you will want to remove a project from the server, be it for cleaning up or to improve the speed of your data warehouse (by limiting the scope of data being queried).

Deleting a Team Project

Deleting a team project is a drastic move; therefore it is not available through the user interface (UI). Rather you must use the TfsDeleteProject command-line tool.

Important

When you delete a team project, Team System removes references to the project in Team Explorer, SharePoint portal site, and Reporting Services. What it won't delete is your project data within the data warehouse.

One of the most common questions around the delete tool is why version control branches related to the team project can't truly be deleted. You can delete and hide them (using the source control options). One of the answers is that in CMMI, the code and project artifacts need to remain for auditing purposes. Another good reason is that it allows you to restore a version control asset that you may accidentally delete. For example, if you right-click any deleted tree or branch, you can select Undelete to recover the item.

Important

Since the server retains data from a deleted project, you will be unable to create a new team project with the same name as a previously deleted project.

To hide the deleted branch in version control, you can click ToolsOptions, then Source ControlVisual Studio Team Foundation Server. You'll find an option that says "Show deleted items in the Source Control Explorer." Make sure it is unchecked and click Apply.

Important

Do not attempt to hack the data warehouse and try to delete data directly from the tables within SQL Server 2005. The data schemas and relationships are more complex than they appear and the likelihood of corrupting your database and environment is very high.

Another project artifact you can't delete is a work item. The proof of this is that when you look into the Work Item Tracking API, you won't find a delete method. If you want to delete a work item, the best approach is to customize each work item and provide an extra Deleted state. Here is the code to include in your work items to incorporate the Deleted state:

 <FIELD name="Tracking" refname="Stormpixel.Tracking" type="String"> <HELPTEXT>This field is used to track the workflow</HELPTEXT> </FIELD> 

Within the workflow of the work item in question, you need to designate the different states. In the example below, we've added a Deleted state within a Task work item:

 <WORKFLOW> <STATES> <STATE value="Active"> <FIELDS> <FIELD refname="Microsoft.VSTS.Common.ClosedDate"><EMPTY/></FIELD> <FIELD refname="Microsoft.VSTS.Common.ClosedBy"><EMPTY/></FIELD> </FIELDS> </STATE> <STATE value="Closed"></STATE> <STATE value="Deleted"></STATE> </STATES> 

Once you have designated your new state, you have to set up your state transitions. In the example below, we have set up:

 <TRANSITION from="Not Done" to="Deleted"> <REASONS> <DEFAULTREASON value="Item has been marked for deletion"/> </REASONS> <FIELDS> <FIELD refname="Stormpixel.Tracking"> <DEFAULT from="value" value="0" /> </FIELD> </FIELDS> </TRANSITION> <TRANSITION from="Deleted" to="Not Done"> <REASONS> <DEFAULTREASON value="Item has been marked for restoration"/> </REASONS> <FIELDS> <FIELD refname="Stormpixel.Tracking"> <DEFAULT from="value" value="0" /> </FIELD> </FIELDS> </TRANSITION> 

You can then create a query called Deleted Items to show all work items set to the deleted state. Here is the .wiq (work item query) to display all your deleted items (DeletedWorkItems.wiq):

 <?xml version="1.0" encoding="utf-8"?> <WorkItemQuery Version="1"> <Wiql>SELECT [System.Id], [System.WorkItemType], [System.AssignedTo],  [System.CreatedBy], [Microsoft.VSTS.Common.Priority], [System.Title] FROM WorkItems WHERE [System.TeamProject] = @project AND [System.State] = 'Deleted' ORDER BY [Microsoft.VSTS.Common.Priority], [System.Id] </Wiql> </WorkItemQuery> 

Then you can modify all other queries to exclude all items that have been set to Deleted. Here is an example of a query that pulls up all work items that aren't set to a Deleted state: (NonDeletedWorkItems.wiq):

 <?xml version="1.0" encoding="utf-8"?> <WorkItemQuery Version="1"> <Wiql>SELECT [System.Id], [System.WorkItemType], [System.AssignedTo],  [System.CreatedBy], [Microsoft.VSTS.Common.Priority], [System.Title] FROM WorkItems WHERE [System.TeamProject] = @project AND [System.State] NOT CONTAINS 'Deleted' ORDER BY [Microsoft.VSTS.Common.Priority], [System.Id] </Wiql> </WorkItemQuery> 

Important

Please refer to Chapter 6 for more information on how to manipulate and customize a process template and work item types.

Using the TfsDeleteProject Commands

Assuming you installed Visual Studio on your C:\ drive, you can find the TfsDeleteProject tool at the following link: C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies\.

Before you use the TfsDeleteProject command, be sure you clean up your assets. For example, if you have any pending changesets, you should check them in (or delete them). In fact, it would be a good idea to delete your code and commit the changes; it will be a lot cleaner in the end. Here is the command to delete a project:

 TfsDeleteProject.exe 

Here is a table with all the common commands for this tool:

Open table as spreadsheet

Option

Description

/q

This option allows you to delete files quietly; no prompt will appear to confirm the deletion.

/force

When you are deleting a project, there are sometimes circumstances that will prevent a portion of it from being deleted (for example, if a file lock exists on a particular file). The /force option will make the uninstaller continue the process even if some parts cannot be deleted.

/server:servername

The name of the Team Foundation Server where the team project is located. This is required in multiserver environments.

Important

You can't undo the deletion of a team project! All the project files relating to your SharePoint site, SQL Server Reporting Services, and Team Foundation Server will be deleted.

If there are any spaces in the project name or the server name, you should use quotation marks. You need administrative privileges to connect to Team Foundation Server and perform the TFSDeleteProject operation.

Uninstalling Team System

There are very concise instructions in the installation guide (TFSInstall.chm) to delete the components of Team System. The key for getting a clean uninstall is to follow those instructions in the correct order. Of course, you must have administrative privileges to perform the uninstall.

The simplest way of managing Team System (including the uninstall process) is to set it up in Microsoft Virtual Server 2005 R2, which is available as a free download from the Microsoft site (microsoft.com/windowsserversystem/virtualserver). The most important point is that the uninstall will be unnecessary. All you will need to do is to back up and remove the .vhd files from the server.

When you uninstall SQL Server 2005, the data files are retained in the Program Files/Microsoft SQL Server directory. If you are uninstalling to install a more recent version of SQL Server (for example, you may be running a Beta version and want to upgrade to a full retail version), keep in mind that the data will magically reappear in your new installation of Team Foundation Server and you may get installation errors if you install SQL Server in the same directory as the old one without "cleaning it up first.

In case you are wondering, you can find the data contained in folders with names such as MSSQL.1. If you are planning to re-install SQL Server 2005, your best bet is to delete the existing Microsoft SQL Server directory before reattempting a new installation.

If you are working with a Beta version and you need to remove or uninstall, Microsoft has created a tool to facilitate the job. You can download the uninstall tool at http://msdn.microsoft.com/vstudio/support/uninstall/default.aspx.

If your plan is to install a new version of Team System and you are getting configuration errors, use the devenv /ResetUserData and devenv /ResetSettings commands. In some cases, these commands will do the trick. If you are unsure that all the components have been uninstalled, you can use an MSI Inventory tool called msiinv.exe to detect what is installed on your system. You can download the tool at huydao.net/setup/msiinv.zip.

Important

Aaron Stebner has good coverage on how to use the MSI Inventory tool on his Web log. Visit http://blogs.msdn.com/astebner/archive/2005/07/01/434814.aspx.

The tool is especially useful if you can't remove an application using the Add/Remove Programs control panel applet (because it's not appearing for a reason or another), yet you know that the application hasn't been uninstalled. First, run the msiinv tool using the following command:

 msiinv >C:\msilog.txt 

An application like Team Suite will generate an entry that looks something like this:

 Microsoft Visual Studio 2005 Team Suite - ENU Product code: {} Product state: (5) Installed. Package code: {} Version: 8.0.50727.42 AssignmentType: 1 Publisher: Microsoft Corporation Language: 1033 Suggested installation location: C:\Program Files\Microsoft Visual Studio 8\ Installed from: d:\vs\ Package: vs_setup.msi Local package: C:\WINDOWS\Installer\60381.msi Install date: 2005\12\15 Registered to: Jean-Luc David, Serial Code: xxxxx-xxx-xxxxxx-xxxxx 58 features. 0 features are not used. 0 features are advertised. 0 features are absent. 58 features installed to run local. 0 features installed to run from source. 0 features installed for default. 0 features in some other state. 6797 components. 0 qualified. 17 permanent. 1529 shared. 0 patch packages. 

Notice the highlighted product code. To remove Team Suite, you can use the msiexec command using the code as shown below.

 msiexec /x {} 

Important

One of the common culprits of this scenario is the Microsoft Visual J# Redistributable Package. It won't show up in Add/Remove, but, lo and behold, the inventory tool will display it in the list.

If after uninstalling Team Suite, you try to reinstall it and you start getting "Package Load Failure" issues, it means that the .NET Framework 2.0 installation has likely failed. You can get around the problem by following the advice outlined on Aaron Stebner's blog at http://blogs.msdn.com/astebner/archive/2005/04/16/408856.aspx.

Another fantastic resource for install/uninstall issues is the Microsoft Forums (http://forums.microsoft.com). It's a great resource because frankly, it is frequently accessed by members of the product group.



Professional Team Foundation Server
Professional Team Foundation Server
ISBN: 0471919306
EAN: 2147483647
Year: 2004
Pages: 168

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net