将MSTest代码covarage结果转换为XML [英] Convert MSTest code covarage results in to XML
本文介绍了将MSTest代码covarage结果转换为XML的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用此代码将MSTest代码的covarage结果转换为XML格式,我添加了对Microsoft.VisualStudio.Coverage.Analysis.dll的引用,但没有名为CoverageInfoManager的类.我正在使用VS 2010.
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");
它引发错误,提示找不到图像文件"... \ bin \ Debug \ TestProject1.dll""
it throws an error saying "Image file "...\bin\Debug\TestProject1.dll" could not be found"
推荐答案
您需要使用新方法来访问覆盖文件. 我相信这将带您到达那里:
You need to use a new method to access your coverage file. This will get you there I'm sure: