SonarScanner for .NET detected only TEST files

I’m analysing a combination of an Azure Functions project, a class library and a NUnit test project within Azure Devops.

Since yesterday Sonar scanner recognizes all these projects as test projects, while nothing changed on my end.

The previous build that did work properly was 3 september.

WARN: SonarScanner for .NET detected only TEST files and no MAIN files for C# in the current solution
INFO: Importing 3 Roslyn reports
INFO: Found 3 MSBuild C# projects: 3 TEST projects.

Hi @Norbert_Huurnink

Can you confirm which version of the Scanner you are using ? Thanks !

Version: 1.24.0
SonarScanner for MSBuild 5.3.1
INFO: SonarScanner

Hi @Norbert_Huurnink,

That would map to version 4.10.0, while now we have 5.3.1. We’ve changed how test project detection works meanwhile to gain some major performance improvements.

You can find more information about current project detection on dedicated wiki page.

The wiki also contains guideline how to inspect build logs for Understanding why a project was categorised in a particular way.

Based on the changes we did, my guess would be that your Azure Function project and your class library project also contains references to some of the unit test frameworks (likely NUnit). In that case either remove the references if they are not needed or set your project type explicitly (see the wiki page for more details).


Hi, did this also happen on the Sonarqube side of things? We have SQ version

Hi @GCDewski ,

The new project type detection is available from SQ >= 8.9 with Scanner for .NET >= 5.2.0

1 Like

Explicitly configuration using below line works:


I’m using a NuGet package that references NUnit. While I’m able to remove this dependency as I control this NuGet package, I would argue that it’s somewhat undesirable that this affects my project type in Sonar.

Anyway, it’s clear how it works. I appreciate your answer and time, thanks.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.