0

I have two projects in my solution, a class library and a test library (lets call them Library and Tests.Library).

My library project targets .NETStandard2.0 and my test project is based on the visual studio NUnit project template (using coverlet), and targets .Net 6.

In summary, due to a dockerized ci-pipeline, I am doing the following:

  • dotnet build
  • dotnet publish -o Publish --no-build
  • remove all bin and obj folders
  • dotnet test Publish/Tests.*.dll --collect:"XPlat Code Coverage"

The tests runs successfully and a coverage file is created as expected (TestResults\{guid}\coverage.cobertura.xml), but it is empty:

<?xml version="1.0" encoding="utf-8"?>
<coverage line-rate="0" branch-rate="0" version="1.9" timestamp="1682064358" lines-covered="0" lines-valid="0" branches-covered="0" branches-valid="0">
  <sources />
  <packages />
</coverage>

If I keep Library\obj folder, the file contains the expected coverage data.

Why do I need to keep the Library\obj and is there a way to get rid of it?

fharreau
  • 2,105
  • 1
  • 23
  • 46

0 Answers0