Generating accessor assemblies in Team Build 2008 using MSBuild 4.0.

I recently blogged about how to configure Team Build 2008 to build Visual Studio 2010 solutions. You can read about it here.
This works fine for compilation, and in most cases the test execution is done correctly as well. However, when you use test accessors to test private members in your assembly, MSBuild 4.0 will not generate the accessor assemblies correctly for Visual Studio 2008 solutions.

To solve this problem, one of the Team Build targets files has to be updated. Fortunately, Microsoft has already created a patch for this. This patch is part of the installation software for Team Build 2010.
So what you can do, is install the Team Build 2010 software on your build server.
The nice thing about the team Build 2010 installation is, that it only installs the Team Build 2010 software. It does not configure Team Build 2010 yet. Configuring Team Build 2010 can be done with the Team Foundation administration console. However, since we are not using Team Build 2010, we don’t need to configure Team Build 2010.

Another issue you might hit is that in some cases the wrong version of MSTest is used to execute the tests, which can have some undesired results. This can easily be solved by using a new version of the TestToolsTask that is able to switch between MSTest 9.0 and MSTest 10.0.
This new version of this task is also installed on your build machine when you install the Team Build 2010 software. The Team Build 2008 targets file is updated so that the build process uses this MSBuild task, if needed.

So by just installing the Team Build 2010 software on your build server the required patches are installed to execute MSTest 9.0 and MSTest 10.0 tests without any problem using Team Build 2008.