There is a problem in Team Build 2010 when executing Unit Test cases from a Visual Studio 2008 solution. The test cases run, but when MSTest tries to publish the results to TFS, then you get this error: TF270015: ‘MSTest.exe’ returned an unexpected exit code. Expected ‘0’; actual ‘1’. Not very informational, and pretty cryptic. Digging around a little, I found this on MS Connect: http://connect.microsoft.com/VisualStudio/feedback/details/576322/tf270015-mstest-exe-returned-an-unexpected-exit-code-expected-0-actual-1
They have a hotfix for this, released last month: http://code.msdn.microsoft.com/KB983504/Release/ProjectReleases.aspx?ReleaseId=4749
They don’t specify where the hot-fix should run, we ran it on the build machine and everything works fine now.
Another solution to this problem would’ve been to find the MSBuild task on the build workflow and point it to the 3.5 version rather than the 4.0 that it uses by default on TFS 2010, but what we implemented seemed like a more long-term solution.