When running this command in a powershell script:
dotnet-coverage collect -s "codecoverage.xml" -f cobertura -o coverageFile.xml "dotnet test ./MyTest.csproj --no-build --configuration Release --results-directory TestResults --logger trx --collect `"XPlat Code Coverage;Format=cobertura`""
I get a warning: No code coverage data available. Profiler was not initialized. and indeed the coverageFile.xml is empty:
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<coverage line-rate="1" branch-rate="1" complexity="1" version="1.9" timestamp="1721989043">
<packages />
</coverage>
Note that both the project and the testproject are a net6.0 project with RuntimeIdentifier win-x86.
And using a net48 project + test project works fine.
When running this command in a powershell script:
I get a warning:
No code coverage data available. Profiler was not initialized.and indeed the coverageFile.xml is empty:Note that both the project and the testproject are a net6.0 project with RuntimeIdentifier win-x86.
And using a net48 project + test project works fine.