How to set-up multi-language (java c#) project with teamcity support?


I got stuck setting up the multi language project with teamcity and sonarqube.

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
    SonarQube 7.9.1, TeamCity 2020.2, Scanner 4.2.0 (MSBuild 4.8.0)

  • what are you trying to achieve
    I have a project, which has at the same time Java and C# code.
    Its build up like that:

  • cs
    ** bin
    *** Debug

  • java

  • target

I now want all information from java and c# in the same SonarQube Project.

  • what have you tried so far to achieve this
    TeamCity Build Steps
  1. SonarScanner for MSBuild, begin analysis
  2. Visual Studio rebuild
  3. SonarScanner for MSBuild, finish analysis
  4. Maven build
  5. SonarQube Runner

Both SonarScanner and SonarQube Runner have the same Projekt Name and Key

My current problem is, that the second language, always overrides the first language.
When I look after the MSBuild fnishes analysis step into SonarQube, I can find the C# code information, etc.
But when SonarQube Runner finishes, all C# code information is removed and only the java information is available.
Also the other way around. If maven build and sonarqube runner first and then sonarscanner msbuild afterwards, the c# code wins

How can I get both?


Here the information the teamcity log gives for the starting parameters:

Starting SQS from E:\BuildAgent\tools\sonar-qube-scanner.

Starting: E:\BuildAgent\tools\sonar-scanner-msbuild.\MSBuild.SonarQube.Runner.exe “/d:project.home=.” “/” “/d:sonar.jdbc.url=postgresql://localhost/sonarqube” “/d:sonar.jdbc.username=xxxxxx” “/k:ProjectName” “/n:ProjectName” “/d:sonar.modules=Modul1” “/d:sonar.password=" "/d:sonar.login=” begin
in directory: E:\BuildAgent\work\10ac011372d37747

Starting: E:\BuildAgent\plugins\dotnetPlugin\bin\JetBrains.BuildServer.MsBuildBootstrap.exe /workdir:E:\BuildAgent\work\10ac011372d37747 “/msbuildPath:C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\bin\MSBuild.exe”
in directory: E:\BuildAgent\work\10ac011372d37747

Starting: E:\BuildAgent\tools\sonar-scanner-msbuild.\MSBuild.SonarQube.Runner.exe “/d:sonar.password=" "/d:sonar.login=” end