How to Fix Missing Code Coverage in Azure DevOps

One problem that annoyed me for months was the missing code coverage in our build jobs in Azure DevOps. The metric vanished from one day to another for the .Net 4.x projects. Whatever I tried with the options in the Visual Studio Test task, all I could produce was this link to the Microsoft documentation:

No coverage metrics for my builds

Last week I was quick enough to get the *.trx file of the test run before it got deleted by the build agent. At the end of a nearly 18,000 lines long file I got the important notice to solve this problem:

Data collector ‘Code Coverage’ message: Cannot find CodeCoverage.exe..

A search in Google got me to an issue on GitHub with an image like this one about the editions of Visual Studio:

Only the Enterprise edition has code coverage

Code coverage is only part of the Enterprise edition, but we run the Community edition on the build server. I installed the Enterprise edition and on the next run of the build job the code coverage metric was back:

Now again with code coverage.

If you run into the same problem, try to install the enterprise edition. It may solve your missing code coverage as well.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.