One of the nice features of Visual Studio is the integrated code coverage. It gives you a nice view how much of your code is covered by (unit) tests. After enabling this feature on my local Visual Studio environment, I noticed that this setting was not automatically duplicated to our build environment.
You have one extra step to enable the code coverage functionality on your build server. Add the following line in TFSBuild.proj after <RunConfigAnalysis> tag.
1: <RunConfigFile>$(SolutionRoot)\YourAppDir\LocalTestRun.testrunconfig</RunConfigFile>
By default, the Microsoft.TeamFoundation.Build.targets files defines the SolutionRoot property as:
SolutionRoot = $(BuildDirectoryPath)\$(TeamProject)\$(TeamBuild)\BuildType\..\Sources
So if you have created a new Build Type under a team project named TestProject and set the New Build Type Wizard’s values to the following:
- Team Build Name = CI Build
- BuildPath = C:\Build
the resulting final SolutionRoot property would be C:\Build\TestProject\CI Build\Sources.