ERROR: Caused by: You must install a plugin that supports the language 'C#'

Hi,

I am new to sonarqube. We are trying to run sonarqube as a build step in Teamcity(CI/CD Tool). But i ended up with error. Please see the error below,

[12:11:29] *Step 7/14 *: Sonar static analysis start (SonarQube Runner)* (4s)*

[12:11:29] *Starting SQS from C:\BuildAgent\tools\sonar-qube-scanner.2.4-runner*

[12:11:29] *-classpath*

[12:11:29] *C:\BuildAgent\tools\sonar-qube-scanner.2.4-runner\lib\sonar-runner-dist-2.4.jar*

[12:11:29] *org.sonar.runner.Main*

[12:11:29] *"-Dproject.home=."*

[12:11:29] *"-Dsonar.host.url=[http://***-teamcity-01:9000](http://****-teamcity-01:9000/)"*

[12:11:29] *"-Dsonar.projectKey=TopbarTrunk"*

[12:11:29] *"-Dsonar.projectName=Topbar - Nightly Builds"*

[12:11:29] *"-Dsonar.projectVersion=1.0.0.1420"*

[12:11:29] *"-Dsonar.login=****

[12:11:29] *-Dsonar.login=******

[12:11:29] *"-Dscanner.home=C:\BuildAgent\tools\sonar-qube-scanner.2.4-runner"*

[12:11:29] *Starting: C:\BuildAgent\jre\bin\java.exe -classpath C:\BuildAgent\tools\sonar-qube-scanner.2.4-runner\lib\sonar-runner-dist-2.4.jar org.sonar.runner.Main "-Dproject.home=." "-Dsonar.host.url=[http://***-teamcity-01:9000](http://****-teamcity-01:9000/)" "-Dsonar.projectKey=TopbarTrunk" "-Dsonar.projectName=Topbar - Nightly Builds" "-Dsonar.projectVersion=1.0.0.1420" "-Dsonar.login=*****" -Dsonar.login=**********"-Dscanner.home=C:\BuildAgent\tools\sonar-qube-scanner.2.4-runner"*

[12:11:29] *in directory: C:\BuildAgent\work\1.0*

[12:11:29] *SonarQube Runner 2.4*

[12:11:29] *Java 1.8.0_121 Oracle Corporation (32-bit)*

[12:11:29] *Windows 10 10.0 x86*

[12:11:29] *INFO: Runner configuration file: NONE*

[12:11:29] *INFO: Project configuration file: C:\BuildAgent\work\1.0\.\sonar-project.properties*

[12:11:29] *INFO: Default locale: "en_AU", source code encoding: "UTF-8"*

[12:11:29] *INFO: Work directory: C:\BuildAgent\work\1.0\.\.sonar*

[12:11:29] *INFO: SonarQube Server 6.5.0.27846*

[12:11:30] *12:11:30.902 INFO - Load global settings*

[12:11:30] *12:11:30.989 INFO - Load global settings (done) | time=90ms*

[12:11:30] *12:11:31.009 INFO - User cache: C:\Users\teamcity\.sonar\cache*

[12:11:31] *12:11:31.261 INFO - Load plugins index*

[12:11:31] *12:11:31.293 INFO - Load plugins index (done) | time=32ms*

[12:11:31] *12:11:31.999 INFO - Process project properties*

[12:11:31] *12:11:32.024 INFO - Load project repositories*

[12:11:32] *12:11:32.273 INFO - Load project repositories (done) | time=249ms*

[12:11:32] *12:11:32.344 INFO - Load quality profiles*

[12:11:32] *12:11:32.478 INFO - Load quality profiles (done) | time=134ms*

[12:11:32] *12:11:32.483 INFO - Load active rules*

[12:11:33] *12:11:33.224 INFO - Load active rules (done) | time=741ms*

[12:11:33] *12:11:33.226 INFO - Load metrics repository*

[12:11:33] *12:11:33.309 INFO - Load metrics repository (done) | time=83ms*

[12:11:33] *12:11:33.345 WARN - SCM provider autodetection failed. No SCM provider claims to support this project. Please use sonar.scm.provider to define SCM of your project.*

[12:11:33] *12:11:33.345 INFO - Publish mode*

[12:11:33] *12:11:33.345 INFO - Project key: TopbarTrunk*

[12:11:33] *12:11:33.347 INFO - ------------- Scan Topbar - Nightly Builds*

[12:11:33] *12:11:33.461 INFO - Load server rules*

[12:11:33] *12:11:33.648 INFO - Load server rules (done) | time=187ms*

[12:11:33] *INFO: ------------------------------------------------------------------------*

[12:11:33] *INFO: EXECUTION FAILURE*

[12:11:33] *INFO: ------------------------------------------------------------------------*

[12:11:33] *Total time: 4.277s*

[12:11:33] *ERROR: Error during Sonar runner execution*

[12:11:33] *Final Memory: 8M/77M*

[12:11:33] *INFO: ------------------------------------------------------------------------*

[12:11:33] *ERROR: Unable to execute Sonar*

[12:11:33] *ERROR: Caused by: You must install a plugin that supports the language 'C#'*

[12:11:33] *ERROR:*

[12:11:33] *ERROR: To see the full stack trace of the errors, re-run SonarQube Runner with the -e switch.*

[12:11:33] *ERROR: Re-run SonarQube Runner using the -X switch to enable full debug logging.*

[12:11:33] *Process exited with code 1*

[12:11:33] *Process exited with code 1 (Step: Sonar static analysis start (SonarQube Runner))*

[12:11:33] *Step Sonar static analysis start (SonarQube Runner) failed*

The error log shows that “we have to install plugin for c#”.
We are assuming that this is the only error causing this issue or should we look at any other thing in the error log.
If this is the error can you please let me know which plugin do i have to use.
Your help will be appreciated. Thanks.

Hello @sudheer.kumar and welcome to the community :wave:

what version of sonarqube are you using? For the newer releases the c# language plugin should be baked into the installation.
Also how do you trigger the scan. it looks like you are trying to use the scanner-cli tool which is not designed for languages of the c family. maybe this doc will help you to get started: https://docs.sonarqube.org/latest/analysis/languages/csharp/

Hi Tobias,

Thanks for the reply.
We are using version 6.5.0.27846 of sonarqube.

I have installed “SonarScanner for .Net” plugin under “C:\sonarqube\sonarqube-6.5\bin”. Then my problem has been resolved. But another problem arose. Please see the error below.

[11:47:53] Starting SQS from C:\BuildAgent\tools\sonar-qube-scanner.4.2.0.1873-scanner

[11:47:53] -classpath

[11:47:53] C:\BuildAgent\tools\sonar-qube-scanner.4.2.0.1873-scanner\lib\sonar-scanner-cli-4.2.0.1873.jar

[11:47:53] org.sonarsource.scanner.cli.Main

[11:47:53] “-Dproject.home=.”

[11:47:53] “-Dsonar.host.url=http://****-teamcity-01:9000

[11:47:53] “-Dsonar.projectKey=TopbarTrunk”

[11:47:53] “-Dsonar.projectName=Topbar - Nightly Builds”

[11:47:53] “-Dsonar.projectVersion=1.0.0.1431”

[11:47:53] “-Dsonar.sources=.”

[11:47:53] “-Dsonar.login=*****”

[11:47:53] -Dsonar.login=LoginToken

[11:47:53] “-Dscanner.home=C:\BuildAgent\tools\sonar-qube-scanner.4.2.0.1873-scanner”

[11:47:53] Starting: C:\BuildAgent\jre\bin\java.exe -classpath C:\BuildAgent\tools\sonar-qube-scanner.4.2.0.1873-scanner\lib\sonar-scanner-cli-4.2.0.1873.jar org.sonarsource.scanner.cli.Main “-Dproject.home=.” “-Dsonar.host.url=http://******-teamcity-01:9000” “-Dsonar.projectKey=TopbarTrunk” “-Dsonar.projectName=Topbar - Nightly Builds” “-Dsonar.projectVersion=1.0.0.1431” “-Dsonar.sources=.” "-Dsonar.login=*****" -Dsonar.login=LoginToken “-Dscanner.home=C:\BuildAgent\tools\sonar-qube-scanner.4.2.0.1873-scanner”

[11:47:53] in directory: C:\BuildAgent\work\1.0

[11:47:53] INFO: Scanner configuration file: C:\BuildAgent\tools\sonar-qube-scanner.4.2.0.1873-scanner\conf\sonar-scanner.properties

[11:47:53] INFO: Project root configuration file: C:\BuildAgent\work\1.0.\sonar-project.properties

[11:47:53] INFO: SonarQube Scanner 4.2.0.1873

[11:47:53] INFO: Java 1.8.0_121 Oracle Corporation (32-bit)

[11:47:53] INFO: Windows 10 10.0 x86

[11:47:54] INFO: User cache: C:\Users\teamcity.sonar\cache

[11:47:54] INFO: SonarQube server 6.5.0

[11:47:54] INFO: Default locale: “en_AU”, source code encoding: “UTF-8”

[11:47:54] INFO: Load global settings

[11:47:55] INFO: ------------------------------------------------------------------------

[11:47:55] INFO: EXECUTION FAILURE

[11:47:55] INFO: ------------------------------------------------------------------------

[11:47:55] INFO: Total time: 1.416s

[11:47:55] INFO: Final Memory: 4M/15M

[11:47:55] ERROR: Error during SonarQube Scanner execution

[11:47:55] INFO: ------------------------------------------------------------------------

[11:47:55] ERROR: Not authorized. Please check the properties sonar.login and sonar.password.

[11:47:55] ERROR:

[11:47:55] ERROR: Re-run SonarQube Scanner using the -X switch to enable full debug logging.

[11:47:55] Process exited with code 2

[11:47:54] Process exited with code 2 (Step: Sonar analysis (SonarQube Runner))

[11:47:55] Step Sonar analysis (SonarQube Runner) failed

I have created a token in sonarqube and gave that token in the additional parameters field in teamcity. But when i run the build it shows me two logins(see error log). i couldn’t find any additional logins given in teamcity for sonarqube. Can you tell me why i am getting two logins.

If i have configured it wrong. Can you please tell me which properties file do i have to edit to give login access. Thanks.

If you are really using sonarqube 6.5.0.27846 you should update rather soon. we just released sonarqube 8.6 and 6.5 is eol since a few years now, but i am assuming that this is a typo and you are on 8.6 :wink:

There should only be one property provided for sonar.login, so the second set of this property will overwrite the first one, resulting in a failed authentication. are you using this plugin here from jetbrains, or how do you run the scanner in team city? if you are using the mentioned plugin, you should try to contact the jetbrains support as this plugin is not written or supported by sonarsource

Hi Tobias,

I have tried with only one property as well, but it is showing the same error. In the log it is showing that i have to change the login details in properties file. “Can you tell me which properties file do i have to edit this login details”

We have configured a build step in teamcity with runner type as “sonarqube runner” to run the sonarqube analysis.

Hi @sudheer.kumar ,

this plugin is not developed by sonarsource so i have no information about that other than i could trace it back to this github repo:

i think your best shot is to create an issue on this repo or open a support case with jetbrains about this plugin. in general you should configure your scanner with a file called sonar.properties as explained in our docs here.

good luck with jetbrains and i hope this get’s resolved for you soon :slight_smile:

Hi Tobias,

  1. Error: Caused by: You must install a plugin that supports the language c#:

This error is caused because i have added sonar.language in properties file. When i removed sonar.language from sonar-project.properties, this error is gone.

And then another error appeared.

  1. *ERROR: Not authorized. Please check the properties sonar.login and sonar.password.

This is caused because i have added authentication token and it is not accepting authentication token.
But, when i removed authentication token and added sonar.login and sonar.password. it started working and my build step in teamcity went well until the end.

Again i got this error. Please see below,

Please help…Thank you…

Hi @sudheer.kumar ,

i am really unsure if this is going to work what you try, but this error message states that the scanner ran out of heap space, so you have to increase the heap space on this execution node. you can do this either by passing the argument (-Xmx4G for 4GB ) to the scanner directly or as an environment variable (SONAR_SCANNER_OPTS="-Xmx4G").
still please clarify if you are able to scan a c# solution with this plugin, as i think you will need our scanner for msbuild