tags:

views:

2348

answers:

4
+1  A: 

When you said:

The actual solutions themselves and the projects they hold build correctly

do you mean that they build correctly within the IDE, or that you can go to those solution directories on the command line and run 'msbuild foo.proj' or 'msbuild bar.sln'?

Anyway, things I would try are first narrow down the offending solution/project, by telling TFS not to build in parallel, turn off multi-CPU support (e.g. '-maxcpucount:1'), do a binary search by trimming away solutions/projects. Once you get to the offending set, build with the '-v:diag' parameter to get even more details about the state of the MSBuild engine.

Alternately, you can write a small C# app that invokes the MSBuild engine directly and debug that application by catching first chance exceptions and having Reflector handy. See sample code in MSBuild Engine Class.

Ants
I'm having a similar error and I'm trying to implement your suggestions. How do I tell TFS not to build in parallel?
spilliton
Um, set BuildSolutionsInParallel property to false.
Ants
+3  A: 

I believe the solution file is corrupt, and VS is being more tolerant. (If I remember correctly this crash can be caused by an unmatched curly parenthesis)

If it's feasible, I would recreate the solution file from within VS. Dan (msbuild team)

As a side note, I've been googling for a solution to the *exact same* problem for several hours. I ended up rebuilding the solution file and everything's good now. In comparing the solution files, I had some project GUIDs incorrectly matched . . .
joshua.ewer
A: 

Hmmm. You get a NullReferenceException, meaning that one of the parameters into that task is a null when it shouldn't be. Dumb question, but have you set up your TFSBuild.proj file with the solutions you want to build? IE. the stuff you put into the - Itemgroup.

If you have, I would suggest adding message tasks to the Teambuild targets file just above the failing task to write out diagnostic information, like so:

That should spew some diagnostics info into your buildlog just above the log exerpt you pasted on your next build.

epaulsen
A: 

You may want to give the MSBuild-Sidekicks a try. They have a nifty little debugger for MSBuild included and offer a 14-day trial version: http://www.attrice.info/msbuild/

TToni