I'm trying to restrict the assemblies that get analyzed in the Code Coverage procedure in TFS by using a runsettings file, but some assemblies insist in being analyzed even if I exclude them explicitly.
This is my current runsettings
file contents:
<?xml version="1.0" encoding="utf-8"?>
<RunSettings>
<!-- Configurations for data collectors -->
<DataCollectionRunSettings>
<DataCollectors>
<DataCollector friendlyName="Code Coverage"
uri="datacollector://Microsoft/CodeCoverage/2.0"
assemblyQualifiedName="Microsoft.VisualStudio.Coverage.DynamicCoverageDataCollector, Microsoft.VisualStudio.TraceCollector, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<Configuration>
<CodeCoverage>
<ModulePaths>
<Include>
<ModulePath>.*Cloud4Mobile.*</ModulePath>
</Include>
<Exclude>
<ModulePath>.*Tests.dll$</ModulePath>
<ModulePath>.*TestUtilities.dll$</ModulePath>
</Exclude>
</ModulePaths>
<CompanyNames>
<Include>.*Mobiltec.*</Include>
</CompanyNames>
</CodeCoverage>
</Configuration>
</DataCollector>
</DataCollectors>
</DataCollectionRunSettings>
</RunSettings>
But when I run code coverage from Visual Studio to test this file, the analysis still shows me other assemblies that do not match my filter, like AutoMapper and CacheManager:
Note that my settings already exclude these assemblies by default, but even then I tried to explicitly exclude them to no avail, like this:
<Exclude>
<ModulePath>^AutoMapper.dll$</ModulePath>
...
</Exclude>
I tried all variations of the regex there, from the less restrictive (using .*) to the most restrictive (like that example). These assemblies are polluting the report that I get on the TFS Build summary, and I'd like to remove them from the analysis. This is the full output that I was getting from TFS, which is obviously quite useless:
I managed to remove most of those with this .runsettings configuration file, but how do I make sure these outliers do not show there too? Why are they even showing in the first place, considering they were not matched by my include filters at all?
This may seem obvious, but did you update your build definition to include the .runsettings file? It's one thing to have CodeCoverage enabled in your build, but you have to provide the path to the .runsettings file.
My guess would be that the
.
inAutomapper.dll
is causing the problem. Could you try usingFor your case of excluding everything by default you should just use
.*\.dll
in the modulepaths exclusions.