Excluding specific namespaces from code coverage calculation in dotnet core

Hi, I have a dotnet core 8 solution with 2 projects (web app + tests); in the build pipeline stage I’ve enabled the code coverage by using the collect option of the dotnet test.
How can I exclude certain namespaces from the coverage calculation?

Depends on the coverage collector you’re using. Every one I know can perform filtering, but each one does it differently. If this is standard vstest, then add a run settings file to configure the coverage collection.

https://learn.microsoft.com/en-us/visualstudio/test/configure-unit-tests-by-using-a-dot-runsettings-file?view=vs-2022|https://learn.microsoft.com/en-us/visualstudio/test/configure-unit-tests-by-using-a-dot-runsettings-file?view=vs-2022