I am compiling an .Netcore application using Azure DevOps build pipeline. In the .Netcore test build task, I have passed the below arguments for collecting the code coverage results:
--configuration $(BuildConfiguration) --collect"XPlat Code Coverage"
For publishing Code Coverage results, I have used "Publish Code Coverage Results" build task using "Cobertura" tool.
The code coverage analyzes all solution assemblies that are loaded during unit tests. But I want to exclude test code from code coverage results and only include application code through the Azure DevOps build pipeline.
For that I have referred this documentation. Based on this documentation you need to add the “ExcludeFromCodeCoverageAttribute” attribute to each test class. But I want do it through the Azure DevOps build pipeline.