Why does Visual Studio say "Code Coverage is not enabled for this test run" when it's enabled?

I used to struggle with MSTest, in a lot of areas (including code-coverage) - frankly, it* doesn't exactly go out of its way to make life easy - especially with the extra testrunconfig etc duplicating a lot of things already in the csproj.

Anyway; than I found that TestDriven.NET has this built in (as long as you have the right edition of Visual Studio to include MSTest and coverage):

alt text
(source: mutantdesign.co.uk)

This will use your existing test framework (including MSTest), but it will jump through all the usual hoops to get test coverage enabled, without you needing to mess with the configuration. It even works with the source-code colorization (red/blue untested/tested etc). Handy.

*=the tool itself, and the GUI integration


Take a look at this page and see if that helps: Tips on Using Code Coverage in Visual Studio 2005

He had an issue even after setting the configuration file you mentioned and the issue was related with assemblies located on GAC.