Sunday, March 12, 2006

TFS: Team Build Bug

If you have two VS Solutions and a common project included in both of them, and wishes to have a Team Build you’ll stumble in the following error…

"Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression."

By taking a look at the TFS Server’s event log you’ll see that the error occurred on line 46 of the sp_InsertProjectDetails stored procedure when TFS Build consumes the web service http://TFSServer/Build/v1.0/BuildStore.asmx. And unfortunately, TFS Build database’s stored procedures are encrypted so you can’t go any further there.

It seems that TFS Build analyses all solutions within a build and records each one and the project file in the FileDirectory table, and the ProjectDetails table holds a ProjectFileId column with the solution or project file Id, as well as a ParentProjectFileId column, both of which act as foreign keys for table FileDirectory.
So for this situation, FileDirectory table recorded the ProjectFileId against two different ParenProjectFileId of the two solutions. So here comes the sub-select in sp_ InsertProjectDetails and the unjustified assumption that each ProjectFileId appears once within the FileDirectory table.

For a workaround, make sure that each project appears only once in your Team Build.

No comments: