.NET core 3.1 scan on dotnet/sdk container problem

I need some help with sonar-scanner. I’m trying to scan .NET core 3.1 C# solution.
The scan runs but no cs files are actually being scanned.
I’m using:
SonarQube server 7.9.4, sonar-scanner 5.0.4, Java Debian, Linux 4.19.121-linuxkit amd64.

The command that I’m using to run the scanner is:
/sonar/sonar-scanner -Dsonar.projectKey=com.ncr.emerald.selling.services

The C# sensor is being loaded but I get the following:
10:41:26.363 INFO: Sensor C# Properties [csharp]
10:41:26.364 WARN: Property missing: ‘sonar.cs.analyzer.projectOutPaths’. No protobuf files will be loaded for this project.
10:41:26.364 WARN: No Roslyn issues report found for this project.

In the end cs files are being indexed but not scanned.
what am I missing?

thanks a lot,


Welcome to the community!

For .NET / C#, you should be using the SonarScanner for .NET. It will handle most of your project config (including source code locations) for you. You’ll need to pass a few basic parameters in on the command line, but the docs go over all that.



thank you :slight_smile: and for your quick reply,
This is exactly the scanner that I’m using in the global tool installation, but as I sad no cs files are scanned.

P.S I received errors while trying to use “begin end” statements so I cannot insert the command to build the project.


Hi Almog,

Can you provide the logs from your job? Feel free to redact as necessary.


i send you a few log files with different command that i tried
the first is:
/sonar/sonar-scanner begin -Dsonar.projectKey=com.ncr.emerald.selling.services -Dsonar.login=“token” -Dsonar.host.url=http://sonar.ncr.com -Dsonar.projectBaseDir=/app/selling-transaction-management/src/ -Dsonar.sourceEncoding=UTF-8 -X

the log is logs.txt
logs.txt (4.9 KB)

the second command is:
/sonar/sonar-scanner -Dsonar.projectKey=com.ncr.emerald.selling.services -Dsonar.login=“token” -Dsonar.host.url=http://sonar.ncr.com -Dsonar.projectBaseDir=/app/selling-transaction-management/src/ -Dsonar.sourceEncoding=UTF-8 -X

the log is logs1.txt
logs1.txt (1.2 MB)

the 3rd command is:
/sonar/sonar-scanner -Dbegin -Dsonar.projectKey=com.ncr.emerald.selling.services -Dsonar.login="
token" -Dsonar.host.url=http://sonar.ncr.com -Dsonar.projectBaseDir=/app/selling-transaction-management/src/ -Dsonar.sourceEncoding=UTF-8 -X

the log is logs2.txt
logs2.txt (1.2 MB)

thanks :slight_smile:

Hi Almog,

Are you invoking the vanilla sonar-scanner or the .NET-specific dotnet sonarscanner?


i’m using .NET scanner, here is the commands that I’m using to install the environment:

RUN apt update && apt install -y default-jre

RUN echo "# Add .NET Core SDK tools" $'\n'export PATH=$'$PATH:/root/.dotnet/tools' >> ~/.bash_profile

RUN dotnet tool install --global dotnet-sonarscanner --version 5.0.4 && mkdir /sonar && \

    ln -s /root/.dotnet/tools/.store/dotnet-sonarscanner/5.0.4/dotnet-sonarscanner/5.0.4/tools/netcoreapp3.0/any/sonar-scanner- /sonar/sonar-scanner && \
    chmod +x /sonar/sonar-scanner

COPY selling-sonar-scanner.properties /root/.dotnet/tools/.store/dotnet-sonarscanner/5.0.4/dotnet-sonarscanner/5.0.4/tools/netcoreapp3.0/any/sonar-scanner-

RUN ln -s /root/.dotnet/tools/.store/dotnet-sonarscanner/5.0.4/dotnet-sonarscanner/5.0.4/tools/netcoreapp3.0/any/sonar-scanner- /sonar/selling-sonar-scanner.properties

thank you very much :slight_smile:


I manage to find the problem with the installation but when I run the begin step I get the following error:

17:35:47.871 The token you provided doesn’t have sufficient rights to check license.

17:35:47.873 Pre-processing failed. Exit code: 1

this is the properties file:

<?xml version="1.0" encoding="utf-8" ?>

<SonarQubeAnalysisProperties  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.sonarsource.com/msbuild/integration/2015/1">

  <Property Name="sonar.host.url">http://sonar.ncr.com</Property>

  <Property Name="sonar.login">user</Property>

  <Property Name="sonar.password">token</Property>

  <Property Name="sonar.projectBaseDir">/app/selling-transaction-management/src/</Property>

  <Property Name="sonar.sourceEncoding">UTF-8</Property>

  <Property Name="sonar.verbose">true</Property>

  <Property Name="sonar.projectKey">com.ncr.emerald.selling.services</Property>

  <Property Name="sonar.exclusions">bin/**,obj/**,publish/**,build/**,Ncr.Sdk.AMSInterface.LMSAdaptor.Service.AuthHandler/**,Ncr.LMSAdaptor.EvolveMigration/**,Ncr.LMSAdaptor.RabbitMqClient/**</Property>

  <Property Name="sonar.dotnet.key.generation.strategy">safe</Property>


thank you,


Hi Almog,

It would be helpful if you updated this thread with your solution.

Typically we urge you to keep it to one question per thread; otherwise it can get messy. But this one is easy:

  <Property Name="sonar.login">token</Property>

 <Property Name="sonar.password"></Property>

I’ve shown sonar.password empty here to make a point, but you don’t need to include it; just drop the property altogether.



the final solution to the configuration problem is this:
apt update && apt install -y default-jre
dotnet tool install --global dotnet-sonarscanner --version 5.0.4
mkdir /sonar
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/root/.dotnet/tools**/**
COPY SonarQube.Analysis.xml /sonar/SonarQube.Analysis.xml

the problem was i was missing the final / in the path statement.

about the permissions error i’m receiving putting the token into the sonar.login property and removing the sonar.password property did not solve the issue.


1 Like


Seeing the very first message, it seems that you are passing sonar.login also in the command line.

Please choose one or the other, as they will override each other.


Thanks, Mickael.
Actually not. When changed http to https everything started to work.

1 Like

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