Closed ferryferry closed 1 year ago
Never mind, I see the behaviour changed around the -r parameter: see here: https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-test#options
So this now works:
COPY "./dotnet/UserDocuments/Paragon.UserDocuments.Tests" "./dotnet/UserDocuments/Paragon.UserDocuments.Tests"
RUN dotnet test "./dotnet/UserDocuments/Paragon.UserDocuments.Tests/Paragon.UserDocuments.Tests.csproj" --collect:"XPlat Code Coverage" -c Release --logger:"trx;LogFileName=coverage-results.xml" --results-directory ./test-results; exit 0
RUN dotnet tool install -g dotnet-reportgenerator-globaltool && \
export PATH="$PATH:/root/.dotnet/tools" && \
reportgenerator "-reports:./test-results/**/coverage-results.xml" "-targetdir:./test-results/coverage-report" -reporttypes:cobertura```
Great that you figured it out!
Describe the bug We are using the report tool already a couple of years in all our .NET services in a docker build scenario. We are piloting .NET 7 to later target .NET 8 in our images and I faced an issue in the report generator targeting the dotnet/sdk:7.0 image.
I took a look in our existing microservice Dockerfiles (which do work) and it looks like this:
RUN dotnet test "./path-to-csproj.csproj" --collect:"XPlat Code Coverage" -c Release --logger:"trx;LogFileName=api-results.xml" -r ./test-results/api-tests; exit 0
RUN dotnet test "./path-to-csproj.csproj" --collect:"XPlat Code Coverage" -c Release --logger:"trx;LogFileName=api-results.xml" -r ./test-results/service-tests; exit 0
RUN dotnet tool install -g dotnet-reportgenerator-globaltool && \ export PATH="$PATH:/root/.dotnet/tools" && \ reportgenerator "-reports:./test-results/**/coverage.cobertura.xml" "-targetdir:./test-results/coverage-report" -reporttypes:cobertura
So, this works perfectly fine in the
"mcr.microsoft.com/dotnet/sdk:6.0"
image but not in the"mcr.microsoft.com/dotnet/sdk:7.0"
image. So only thing to get it to fail is to change the dotnet sdk version from 6 to 7.To Reproduce The following input helps to reproduce your issue: