Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only the "CollectCoverage" property is working #1414

Closed
artoxian opened this issue Nov 24, 2022 · 6 comments
Closed

Only the "CollectCoverage" property is working #1414

artoxian opened this issue Nov 24, 2022 · 6 comments
Labels
tracking-external-issue The issue is caused by external problem - nothing we can do to fix it directly

Comments

@artoxian
Copy link

I'm following the guide here to try and use coverlet to create a code coverage report.

In summary, I've run the following commands:

dotnet new xunit -n XUnit.Coverlet.MSBuild
cd XUnit.Coverlet.MSBuild
dotnet add package coverlet.msbuild
dotnet test /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura

The issue is with the final step, where the output is:

image

So the output is still the default "coverage.json" instead of the expected cobertura xml.

So I tested with some other properties, and they also don't work:

dotnet test /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura

And the output is exactly the same:

image

I've run the same thing on my home PC, and it is not having the same issues.

The only difference I can think of is that the PC with the issue is a Windows Server 2016 machine, and my home PC is a Windows 10.

I've tried a complete uninstall and reinstall of Visual Studio which didn't help.

Can anyone suggest a way I can get this to work?

@petli
Copy link
Collaborator

petli commented Nov 24, 2022

@artoxian Do you have .NET 7 SDK installed on the machine where it's not working? See #1391 for a discussion of current problems with that SDK version, and links to workarounds.

@artoxian
Copy link
Author

I do have .NET 7 SDK. That is annoying.

@daveMueller daveMueller added the tracking-external-issue The issue is caused by external problem - nothing we can do to fix it directly label Dec 2, 2022
@john0879
Copy link

john0879 commented Dec 6, 2022

I'm having the same issue with .NET 6 and Visual Studio 17.4 using this command:

dotnet test /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura /p:CoverletOutput='../../TestResults/'

@john0879
Copy link

john0879 commented Dec 6, 2022

Tried this instead based on a comment in #1391 and it worked.

dotnet test -p:CollectCoverage=true -e:CoverletOutputFormat=cobertura -e:CoverletOutput='../../TestResults/'

@daveMueller
Copy link
Collaborator

Hi all, the issue was fixed by the microsoft guys with sdk 7.0.101 that was released last week microsoft/vstest#4014. I just checked it with a repro from another related issue and it works fine. Please give it a try again.

@daveMueller
Copy link
Collaborator

I close this as the external issue is fixed. Feel free to reopen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tracking-external-issue The issue is caused by external problem - nothing we can do to fix it directly
Projects
None yet
Development

No branches or pull requests

4 participants