We recently added C# unit test projects to our existing C++ product and unit test projects, but they weren’t being built by our gated check-ins. I did some research and found lots of blog posts. The closes one, and the blog post that got me pointed in the right directory, was Aaron Hallberg’s post on Solution Configurations. He talks about the Mixed Platforms custom platform, as well as creating new platform definitions. However, it turns out the solution to our problem was even simpler. All we had to do is check the C# projects so they would be built as part of the Win32 platform:

image

There are two things to notice about this dialog. First, notice that the active platform is set to Win32, and second notice that the Build checkbox is checked for the second project, which is a C# unit test project built using the Any CPU platform.

Here is the dialog box showing the configurations that are built by our gated check-in build definition on TFS:

image

In other words, the configurations defined in the build definition need to match up with the configurations you’ve defined in the solution files, not in the project files that are included in that solution.

We now have both C++ and C# unit tests running as part of gated check-ins. Life is good!