Sonarqube 7.9.1 unable to scan .cs and sql files for MS project

I am having SonarQube version 7.9.1 and I am running sonar scan through jenkins, It scans all the file but unable to scan .cs and sql file for my MS(dotnet) project. How can I resolve this issue.

sonar-project.properties

sonar.projectKey=MSProject
sonar.projectName=MSProject
sonar.projectVersion=1.0

# Enable the Visual Studio bootstrapper
sonar.visualstudio.enable=true

# Language
sonar.language=cs

# Comma-separated paths to directories with sources (required)
sonar.sources= .

# Encoding of sources files
sonar.sourceEncoding=UTF-8

Also I can see some warnings in jenkins logs from where I am running sonarscanner.Not sure though If it is related.

WARN: Property missing: 'sonar.cs.analyzer.projectOutPaths'. No protobuf files will be loaded for this project.
WARN: No Roslyn issues report found for this project.

I am using sonar scanner version 2.6.1

Hi,

Welcome to the community!

First, your version is past EOL. You should upgrade to either the latest version or the current LTS at your earliest convenience. Your upgrade path is:

7.9.1 → 8.9.2 → 9.1 (last step optional)

You may find the Upgrade Guide and the LTS-to-LTS Upgrade Notes helpful. If you have questions about upgrading, feel free to open a new thread for that here.

Regarding your actual question, you appear to be trying to use the vanilla SonarScanner to analyze C# code. That won’t work; you need to use SonarScanner for .NET. The docs should get you started.

 
HTH
Ann

Hi @Ann, I have gone through the documentation have some doubts do I need to manually install dotnet for scanner by running the command on my server.

dotnet tool install --global dotnet-sonarscanner --version x.x.x

I was running sonar scanner for MSBuild through jenkins, so is there any plugin through which I can achieve this without installing dotnet-sonarscanner.

Hi,

I’m not familiar with .NET tool installation, but you’ll need the scanner available on the Jenkins build agent, however that happens.

 
Ann

Hi,

I have installed Sonar Scanner for MS build on jenkins under Global tool configuration. How can I run now via jenkins pipeline.

Currently I am running with sonar scanner like below

/home/sonar/sonar-scanner-2.2.1/bin/sonar-scanner

I am getting bit confuse how to run sonarscanner for MS build via jenkins. Also wanted to know do I need to install dotnet core also on my jenkins server to run sonarscanner for msbuild.

Hi,

The docs should help.

 
Ann