I want to exclude MVC views—i.e., cshtml
files, which have C# code—from code the coverage report in ADO.
What I have tried is:
Adding the
[ExcludeFromCodeCoverage]
attribute to thecshtml
.Adding exclusion for the
*.Views
assembly in therunsettings
file:<ModulePath>.*Views.*</ ModulePath>
Neither worked. Is there any way of achieving this?
Once I was able to get the
runsettings
file recognized (https://learn.microsoft.com/en-us/visualstudio/test/configure-unit-tests-by-using-a-dot-runsettings-file?msclkid=14b6671abb6811ec9283acde13b7ff4e&view=vs-2022#specify-a-run-settings-file-in-the-ide), I was able to use this to exclude views that were being pre-compiled: