I am using this code to convert MSTest code covarage results to XML format , I added reference to Microsoft.VisualStudio.Coverage.Analysis.dll bu there is no class called CoverageInfoManager . I am using VS 2010.
static void Main(string[] args)
{
String coveragepath = System.IO.Path.GetDirectoryName(args[0]);
CoverageInfoManager.SymPath = coveragepath;
CoverageInfoManager.ExePath = coveragepath;
// Create a coverage info object from the file
String coveragefile = System.IO.Path.GetFullPath(args[1]);
CoverageInfo ci = CoverageInfoManager.CreateInfoFromFile(coveragefile);
// Ask for the DataSet. The parameter must be null
CoverageDS data = ci.BuildDataSet(null);
// Write to XML
String coverageoutput = System.IO.Path.GetFullPath(args[2]);
data.WriteXml(coverageoutput);
}
If I use this code instead of above,
CoverageInfo coverage = CoverageInfo.CreateFromFile(@"....\data.coverage");
it throws an error saying "Image file "...\bin\Debug\TestProject1.dll" could not be found"
You can find a tool that does the conversion to clover and to html format
The code is located at github.
This tool also uses a xsl transformation to create the html report.
I had the same problem, I needed to convert the coverage file to coveragexml by command line.
You might want to use the CoverageInfo and CoverageDS objects as depicted on snip2code.
Link: How to programmatically convert the Visual Studio coverage file to coveragexml by command line tool in csharp
You need to use a new method to access your coverage file. This will get you there I'm sure:
http://blogs.msdn.com/b/phuene/archive/2009/12/01/programmatic-coverage-analysis-in-visual-studio-2010.aspx