Workaround for TFS2010 MissingFieldException when attaching Team Project Collection

July 26, 2011

Summary: I was doing a Team Foundation Server 2010 (TFS2010) migration project for a customer a few weeks ago and ran into problems when attempting to attach a migrated Team Project Collection (TPC).  Although the customer assured me that the source instance of TFS2010 had never been attached to Microsoft Project Server, the collection contained some dependency on a work item field used by Project Server and the “attach” failed.

Under the surface, when TFS2010 needs to perform a “servicing operation” such as attaching a TPC, it uses a number of different XML-based scripts that describe the operations it should perform.  The workaround was to temporarily modify the servicing operation script that TFS uses to attach the TPC.

The Problem: When attaching a Team Project Collection (TPC), the attach fails on the Project Server step with System.MissingFieldException: Field not found: 'Microsoft.TeamFoundation.Framework.Common.CatalogResourceTypes.ProjectServerRegistration'.

...
[Info   @19:14:32.586] [2011-07-20 19:10:24Z] Servicing step Attach the Test Management Catalog Entries passed. (ServicingOperation: AttachCollection; Step group: AttachCollection.TfsTestManagement)
[Info   @19:14:32.586] [2011-07-20 19:10:24Z] Executing servicing step Attach the Project Server Catalog Entries. (ServicingOperation: AttachCollection; Step group: AttachCollection.TfsProjectServer)
[Info   @19:14:32.586] [2011-07-20 19:10:24Z][Informational] Step Performer: ProjectServer
[Info   @19:14:32.586] [2011-07-20 19:10:24Z][Informational] Step Type:      AttachCatalogEntries
[Info   @19:14:32.586] [2011-07-20 19:10:24Z][Informational] Step Data Text:
[Info   @19:14:32.586] [2011-07-20 19:10:24Z][Informational] Retrieving target request context.
[Info   @19:14:32.586] [2011-07-20 19:10:24Z][Informational] Target request context has framework connection string: Data Source=tfssql;Initial Catalog=Tfs_MigratedTpc;Integrated Security=True.
[Info   @19:14:32.586] [2011-07-20 19:10:24Z][Informational] ProjectServer: Retrieving PS nodes from Collection...
**[Error  @19:14:32.586] [2011-07-20 19:10:24Z][Error] Field not found: 'Microsoft.TeamFoundation.Framework.Common.CatalogResourceTypes.ProjectServerRegistration'.
**[Info   @19:14:32.586] [2011-07-20 19:10:24Z][Informational] System.MissingFieldException: Field not found: 'Microsoft.TeamFoundation.Framework.Common.CatalogResourceTypes.ProjectServerRegistration'.
at Microsoft.TeamFoundation.Server.Servicing.TFCollection.ProjectServerStepPerformer.GetPWACatalogNodes(TeamFoundationRequestContext requestContext, TeamFoundationCatalogService catalogService)
at Microsoft.TeamFoundation.Server.Servicing.TFCollection.ProjectServerStepPerformer.AttachCatalogEntries(String stepData, ServicingContext servicingContext, Boolean validateOnly)
at Microsoft.TeamFoundation.Framework.Server.TeamFoundationStepPerformerBase.Microsoft.TeamFoundation.Framework.Server.IStepPerformer.PerformStep(String servicingOperation, String stepType, String stepData, ServicingContext servicingContext)
at Microsoft.TeamFoundation.Framework.Server.ServicingStepDriver.PerformServicingStep(ServicingStep step, ServicingContext servicingContext, ServicingStepGroup group, ServicingOperation servicingOperation, Boolean validateOnly)
[Info   @19:14:32.586] [2011-07-20 19:10:24Z] Servicing step Attach the Project Server Catalog Entries failed. (ServicingOperation: AttachCollection; Step group: AttachCollection.TfsProjectServer)
[Info   @19:14:32.586] [2011-07-20 19:10:24Z][Informational] Clearing dictionary, removing all items.
[Error  @19:14:32.586] The servicing operation failed.

The Solution: Temporarily modify AttachCollection.xml to skip the AttachCollection.TfsProjectServer ServicingStepGroup and then re-try the Attach Team Project Collection operation.  Disclaimer: This is only a workaround and assumes that you have received this exception message in error and that you do not need or intend to use Microsoft Project Server with this TPC.

Step 1: Locate the AttachCollection.xml script (see Figure 1).  This file is typically located in
C:Program FilesMicrosoft Team Foundation Server 2010ToolsDeployTfsServicingFilesCollectionOperations.

SNAGHTML4ef99b
Figure 1. The xml scripts that define the TFS2010 servicing operations including AttachCollection.xml

Step 2: Make a backup copy of AttachCollection.xml.

Step 3: Open AttachCollection.xml in a text editor and locate the Project Server step group as shown in Figure 2.  The text of the step group is

SNAGHTML508fe1
Figure 2.  The Project Server step group in AttachCollection.xml

Step 4: Comment out the Project Server ServicingStepGroup element as shown in Figure 3 by surrounding it with XML comment tags () and save the file.

SNAGHTML58563b
Figure 3. The commented out Project Server ServicingStepGroup.

Step 5: Go to the TFS Administrator Console and attach the Team Project Collection.  (This should now succeed.)

Step 6: Re-edit the AttachCollection.xml script so that the Project Server servicing step group is no longer commented out.  When you are done with this step, the step should look like Figure 2 once again.

I hope this helps.

-Ben

-- Having problems upgrading, migrating, or consolidating your Team Foundation Servers?  Want some advice regarding TFS2010 upgrades?  Need someone to walk you through or help you adopt the TFS2010 and the Visual Studio 2010 Ultimate tools?  Drop us a line at info@benday.com.

Categories: team-foundation-server-2010
Tags: tfs