I have this class AspNetCoreGeneratedDocument.Views_Users__AddOrUpdateUser appearring in the code coverage result for each view in the Views folder,
Exemple: AspNetCoreGeneratedDocument.Views_Users__AddOrUpdateUser AspNetCoreGeneratedDocument.Views_Users__GetUser etc...
Assembly: Solution.Web Class: AspNetCoreGeneratedDocument
I want to exclude this folder using the .runsettings file:
<?xml version="1.0" encoding="utf-8" ?>
<RunSettings>
<DataCollectionRunSettings>
<DataCollectors>
<DataCollector friendlyName="XPlat code coverage">
<Configuration>
<!-- Globbing filter -->
<ExcludeByFile>**/Solution.Web/Views/*.cshtml</ExcludeByFile>
<IncludeTestAssembly>false</IncludeTestAssembly>
<DeterministicReport>false</DeterministicReport>
</Configuration>
</DataCollector>
</DataCollectors>
</DataCollectionRunSettings>
</RunSettings>
this is the result i want: this image is from dotCover it allows creating a filter easily
<ExcludeByFile>**/*.cshtml</ExcludeByFile>
So @KA-Yasso code partially works.
It does not does not exclude all of the .cshtml files from the Views folder.
It excludes only the .cshtml files at the root level of the Views folder like _ViewStart.cshtml.
It does not exclude the files that he actually wants to exclude like Views/Users/AddOrUpdateUser.cshtml.
The answer by @red is not meant for coverlet, it won't work, the .runsettings.xml file structure is different.
<ExcludeByFile>**/*.cshtml</ExcludeByFile>
<ExcludeByFile>**/MainApp.MVC/Views/*.cshtml,**/MainApp.MVC/Views/**/*.cshtml</ExcludeByFile>
<ExcludeByFile>**/MainApp.MVC/Areas/Common/Views/*.cshtml,**/MainApp.MVC/Common/Views/**/*.cshtml</ExcludeByFile>
<ExcludeByFile>
is applied.<ExcludeByFile>
.