<p>I need to know how to turn on Code Coverage when running TFS builds on a solution with a .testrunconfig file.  </p>

<p>There is an option in the testrunconfig file that is for code coverage, but when running a TFS build there is no code coverage results.</p>

<p>I am running my tests using the *Tests.dll mask and NOT using Test Lists (.vsmdi).</p>

[{'answer_id': 80600, 'author': 'Martin Woodward', 'author_id': 6438, 'author_profile': 'https://Stackoverflow.com/users/6438', 'pm_score': 5, 'selected': True, 'text': '<p>How are you running the tests?  Are you using a .vsmdi file or just specifying that you run all tests in *Tests.dll assemblies?</p>\n\n<p>If it is the latter and you are using TFS 2008, then you need to add the following to the and of the first PropertyGroup in your TFSBuild.proj file for the build.</p>\n\n<pre><code>&lt;RunConfigFile&gt;$(SolutionRoot)\\TestRunConfig.testrunconfig&lt;/RunConfigFile&gt;\n</code></pre>\n\n<p>This points the build at your .testrunconfig so it can pick up the instructions to run code coverage.</p>\n'}, {'answer_id': 429561, 'author': 'jlo', 'author_id': 48148, 'author_profile': 'https://Stackoverflow.com/users/48148', 'pm_score': 1, 'selected': False, 'text': "<p>You'll need the RunConfigFile entry whether you use the .vsmdi file for Test Lists or just specify the assembly file pattern.  In that .testrunconfig file you specify the assemblies you want to apply code coverage to.</p>\n"}]
['https://Stackoverflow.com/questions/80486', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/5132/']