Some .NET projects are left out (e.g, marked with —)

If you look at this solution: and scroll down to:

  • Cuemon.Extensions.Xunit.Hosting
  • Cuemon.Extensions.Xunit.Hosting.AspNetCore
  • Cuemon.Extensions.Xunit.Hosting.AspNetCore.Mvc

Then you will notice they have zero coverage from SonarCloud.

I have checked configuration thoroughly and is exporting the test result also to, where said mentioned projects are tracked just fine: Codecov

Can you help point me in the right direction to why these projects are left out of SonarCloud?

I have a rule in my Directory.Build.props that only applies to projects ending with 'Tests ', and neither of these are doing that.

Complementary test log: Pipelines - Run 7.0.0-preview.245 logs (


Hey there.

I suspect those projects are being detected as test projects by the scanner, and therefore excluded from code coverage.

Hi Colin,

Thank you for guiding me to self-help … for anyone interested, the solution (which is far from my desire) is to explicitly add this line to the 3 projects;


I must admit, that I am sad to see that this is a necessity because of an assumption from SonarClouds side. I prefer the other way around; tell SonarCloud to only exclude those I have defined (in my case, all my test projects):


Anyway, I hope with this post and the references given, that SonarCloud will consider tweaking their engine.


Hey @gimlichael

I agree it’s not ideal – and I think the bigger question is: what condition is being fulfilled such that the projects are being categorized as test code? Your projects reference XUnit – is there a use-case where a non-test project (that should be covered by code) references XUnit that we aren’t thinking about?

Hi @Colin

Thank you for your reply.

The 3 projects in questions all extend the existing functionality of Xunit (and is also named as such), e.g. it could be that you are parsing reserved words that might or might not indicate a test project. But from my perspective, and the fact I have a strict folder structure, it simply should not be considered something to be excluded. However; good you provide an option to hint your engine.

That being said - and this is just my viewpoint - I think some confusion starts to arise with these different configurations.

Earlier - and this counts for all my test projects - I needed to include this in my project file:
<SonarQubeExclude>true</SonarQubeExclude>, otherwise these would be considered code for testing.

Now you also have the <SonarQubeTestProject>false</SonarQubeTestProject> … I think there is an overlap.

If it can help you guys, consider cloning the solution … then you have first-hand evidence you can teach your engine upon: GitHub - gimlichael/Cuemon: Cuemon for .NET

Hi @gimlichael. The flags do different things:

SonarQubeExclude means “pretend this MSBuild project doesn’t exist”. No information will be pushed to SonarQube/SonarCloud.

All projects that are not excluded will have some information about them pushed to SonarQube/SonarCloud; exactly what depends on whether they are treated as test code or product code

If the scanner isn’t correctly categorising your project, you can manually specify how it should be treated using SonarQubeTestProject.

Thank you for the clarification, @duncanp.