Snippets of the day – Monday, January 6, 2014

Posted on Posted in Snippets


Here are some of the most recently published snippets!

How to programmatically convert the Visual Studio coverage file to coveragexml by command line tool in csharp

This code shows how to programmatically export and convert the coverage data ( .coverage) generated by Visual Studio into a readable xml file (.coveragexml).
The xml file can be used to generated a code coverage report, eg using the ReportGenerator tool.

The conversion is done using the CoverageInfo and CoverageDS objects and invoking the method WriteXml once the data has been parsed from coverage file.

What you need to do is:
1- Create a command line project in Visual Studio.
2- Add a reference to Microsoft.VisualStudio.Coverage.Analysis.dll (eg C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\PrivateAssemblies\).
3- Copy Microsoft.VisualStudio.Coverage.Symbols.dll to the output directory of your project.

This programs takes 3 arguments:
-Args[0]: data coverage file name (eg data.coverage)
-Args[1]: DLL used to generated the coverage file (eg myProject.dll)
-Args[2]: coveragexml file name to be generated (eg converted.coveragexml)

For all args you can specify the full path name.

Original link:

Open the snippet

Author:    lbottaro

Windows-Perl standard #header

Path to the perl binary, and basic #use statements

Open the snippet

Author:    angelofthe0dd

Leave a Reply

Your email address will not be published. Required fields are marked *