which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
sonarqube enterprise version 8.9.3 (build 48735)
scanner for dotNet standalone tool 5.5.3
what are you trying to achieve
i want to report code coverage and other metrics to sonarqube server.
i have a multi-language project - most of it java, with one module in C#.
for the java portion i’m using the sonarqube gradle plugin which works good.
but i’ve come to understand that i can’t use the gradle plufin for C#, so i installed a the standalone tool using ‘dotnet install’.
i went to the SonarQube.Analysis.xml file and updated server url, and credentials.
in the .sln folder i ran:
dotnet-sonarscanner begin /d:sonar.verbose=true /k:
dotnet build file.sln
dotnet test MegaFNativeDriver.sln /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura
i have 2 issues:
if i first run the gradle task (for java) and then the dotnet tool with the same project key - the later run overwrites the old one. how can i make them co exist in the same project?
either way - same project or different - for the dotnet run, nothing appears on the server . there is a project with the name chosen - but no sources, no coverage data, no nothing in it.
so is this the right way to accomplish sonar scan for both java and C# (one with gradle the other with standalone tool)? and why the report is empty for C#, what am i missing?
You’re either going to need two different project keys - one for the Java code and one for the .NET code - or you’re going to have to incorporate your Java analysis into your C# analysis. (It has to be done in that direction. The reverse is not an option.) See “Analyzing languages other than C# and VB” in the docs.
Thank you very much for the quick reply Ann.
i managed to upload C# data to sonarqube server by entering ‘General Settings’ in the project on the server and under ‘Languages’->‘C#’ adding ‘.cs’ to file suffixes. i was also able to upload code coverage data there.
regarding the java modules - the main language of our repo is java, and there are many java modules in the java. just sounds to me like it is not the way to go (adding folders to a csproj file). is there another way maybe that you can think of to accomplish this (single project for java and C# and maybe more languages in the future)? doesn’t have to be using gradle and dotnet scanner, maybe there is some single scanner i can configure? even as a tool?
According to [the docs](https://For newer SDK-style projects (used by .NET Core, .NET 5, and later), the SonarScanner for .NET will analyze all file types that are supported by the available language plugins unless explicitly excluded.) that isn’t necessary “[f]or newr DDK-style projects”. Alternately, have you considered broadening your patterns? I have successfully used this in the past: