我使用VS 2012动态代码覆盖率工具生成了一些覆盖率文件。 我想合并它们以产生一个整合的xml输出。 我正在尝试使用代码来做到这一点。下面是代码,使用VS 2012代码合并代码覆盖率文件动态代码覆盖率
static CoverageInfo JoinCoverageFiles(IEnumerable<string> files)
{
if (files == null)
throw new ArgumentNullException("files");
// This will represent the joined coverage files
CoverageInfo result = null;
try
{
foreach (string file in files)
{
// Create from the current file
CoverageInfo current = CoverageInfo.CreateFromFile(file);
if (result == null)
{
// First time through, assign to result
result = current;
}
else
{
try
{
result= CoverageInfo.Join(result, current);
}
}
}
}
catch (Exception)
{
if (result != null)
{
result.Dispose();
}
throw;
}
return result;
然后得到一个CoverageInfo对象即信息后,我用这些行生成XML文件。
CoverageDS data = info.BuildDataSet(null);
data.Lines.WriteXml("C:\\Users\Desktop\\coveragefiles\\finalCoverage.xml");
通过这些渠道我能够产生finalCoverage.xml,但它是未来空白,它已得到, <?xml version="1.0" standalone="yes"?> <CoverageDSPriv />
我没有得到什么问题,没有例外或什么都没有登录了事件查看器。
请帮我解决问题。