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.
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.
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).
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.