I have a solution. In that solution, I have 4 projects, and an additional project for tests. Coverage is checking 2 of those projects and the test project. I don't really care about excluding the tests, but I do need the 1 project that is for some reason being missed.
I created a .runsettings file and hooked it up in visual studio.
<RunSettings>
<DataCollectionRunSettings>
<DataCollectors>
<DataCollector friendlyName="Code Coverage">
<Configuration>
<CodeCoverage>
<ModulePaths>
<Include>
<!-- https://msdn.microsoft.com/en-us/library/jj159530.aspx
If <Include> is empty, then code coverage processing includes all assemblies (.dll and
.exe files) that are loaded and for which .pdb files can be found, except for items
that match a clause in an <Exclude> list.
-->
</Include>
</ModulePaths>
</CodeCoverage>
</Configuration>
</DataCollector>
</DataCollectors>
</DataCollectionRunSettings>
</RunSettings>
But that didn't find the project. So I tried a ModulePath for "anything" and also tried to explicitly add the DataLoader and DataAccess projects (the one not being checked for coverage)
<RunSettings>
<DataCollectionRunSettings>
<DataCollectors>
<DataCollector friendlyName="Code Coverage">
<Configuration>
<CodeCoverage>
<ModulePaths>
<Include>
<ModulePath>.*</ModulePath>
<ModulePath>src/DataLoader/.*</ModulePath>
<ModulePath>src/DataAccess/.*</ModulePath>
</Include>
</ModulePaths>
</CodeCoverage>
</Configuration>
</DataCollector>
</DataCollectors>
</DataCollectionRunSettings>
</RunSettings>
But it still doesn't work. I can find all kinds of results for how to exclude something from my runsettings, but how can I fix something incorrectly not being included?
My solution structure looks like this:
- Solution
- Solution.sln
- CodeCoverage.runsettings
- ... etc...
- src/
- DataLoader/ (✖️ not checked for coverage)
- DataLoader.xproj
- ...
- bin/Debug/net461/DataLoader.exe and .pdb
- DataAccess/ (✖️)
- DataAccess.xproj
- ...
- bin/Debug/net461/DataAccess.exe and .pdb
- DataService/ (✔️)
- DataService.xproj
- ...
- bin/Debug/net461/DataService.exe and .pdb
- DataModels/ (✔️)
- DataModels.xproj
- ...
- bin/Debug/net452/DataModels.dll and .pdb
- DataLoader/ (✖️ not checked for coverage)
- test/Solution.Test/ (✔️)
- bin/Debug/net461/Solution.Test.dll and .pdb
- ...
- Solution.Test.xproj