2

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.

KMoraz
  • 14,004
  • 3
  • 49
  • 82
jd314159
  • 365
  • 2
  • 14

1 Answers1

1

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

Rolf Huisman
  • 1,417
  • 8
  • 17
  • Thanks Rolf. I ended up building my own c# solution using the TFS interface microsoft provides. Then, I simply extended the build workflow to run this solution and put the results where I want them. – jd314159 Mar 29 '12 at 21:29