Reputation: 395
How do I get the code coverage in a custom build activity?
I'm trying to get the coverage % so I can pass it to another app that I'm running as part of that custom activity.
Upvotes: 2
Views: 634
Reputation: 1437
Coverage is generated by instrumenting the assembly and publisched using vsperfmon. This is agregated after a run is terminated, so you can't retrieve the "current coverage" of your assembly within the same run.
Retrieving the coverage from another run is however posible. You need to read the coverage.data file using the CoverageInfo class from Microsoft.VisualStudio.Coverage.Analysis.dll
Upvotes: 1