SonarQube Community - latest
Using Azure Devops extension
Able to analyze js.typescript c ode, but C# code says 0 lines of code on sonarqube
I’m running on a self hosted build agent
.NET 8.0
Installed dotnet-sdk-8.0 o
installed dotnet tool install --global dotnet-sonarscanner
My yaml
- task: SonarQubePrepare@7
inputs:
SonarQube: 'SonarQube Service Connection'
scannerMode: 'dotnet'
projectKey: ''
I then run dotnet build
Then
- task: SonarQubeAnalyze@7
My logs say this in the beginning
SonarScanner for MSBuild 9.0.2
Using the .NET Core version of the Scanner for MSBuild
Post-processing started.
Calling the SonarScanner CLI...
.
.
.
INFO: SonarScanner 5.0.1.3006
**It gives me this warning**
WARN: Your project contains C# files which cannot be analyzed with the scanner you are using. To analyze C# or VB.NET, you must use the SonarScanner for .NET 5.x or higher,
I;ve already read the ADO integration docs and
.NET environments | SonarQube Community Build Documentation
and that’s why installed dotnet tool install --global dotnet-sonarscanner
on my build agent.
I know the azure sonarqube server extension has the SonarScanner for dotnet built in, so I didn’t even need to install it on the agent.
So it should work…
Should I revert and use the depreciated version of the Azure Devops Sonarqube task
for example ,
SonarQubePrepare@5 instead of SonarQubePrepare@7
cause in version seven, you declare scannerMode: dotnet
in version five, you declare scannerMode: MSBuild
someone was able to fix this issue with version 5, Sensor C# Not Picking Up Some .cs Files - SonarQube Server / Community Build - Sonar Community
So… is this a bug with azure sonarqube devops extension?
Please help asap