Following are the details:
- ALM used (Gitlab)
- CI system used (Gitlab)
- Scanner command used when applicable
- Languages of the repository (C#)
I do not find any step for setting up C# project (.NET platform) in Sonar Cloud in Gitlab Pipeline.
Following are the details:
I do not find any step for setting up C# project (.NET platform) in Sonar Cloud in Gitlab Pipeline.
Hi,
Welcome to the community!
Can I take it from your other thread that you’ve figured this out?
Ann
No, this is still an issue as I found no documentation for this in Sonar. Can you help me how to set this up in pipeline?
Hi,
It’s unfortunate that I don’t have a yaml snippet to give you. I’m going to raise that internally.
And in the meantime, you only need to script the steps you’ve already described in your other post.
HTH,
Ann
While doing so, I get this error in Gitlab pipeline. I am running the sonarcloud so why is it asking for a sonarqube.analysis.xml
$ dotnet sonarscanner begin \ /o:<org> \ /k:<project> \ /d:sonar.host.url=https://sonarcloud.io dotnet sonarscanner end
SonarScanner for MSBuild 6.2
Using the .NET Core version of the Scanner for MSBuild
Invalid command line parameters. Please specify either 'begin' or 'end', not both.
Default properties file was found at /tmp/.dotnet/tools/.store/dotnet-sonarscanner/6.2.0/dotnet-sonarscanner/6.2.0/tools/netcoreapp3.1/any/SonarQube.Analysis.xml
Loading analysis properties from /tmp/.dotnet/tools/.store/dotnet-sonarscanner/6.2.0/dotnet-sonarscanner/6.2.0/tools/netcoreapp3.1/any/SonarQube.Analysis.xml
Following is the command I am running in pipeline:
script:
- dotnet sonarscanner begin \
/o:org \
/k:org_proj \
/d:sonar.host.url=https://sonarcloud.io
dotnet sonarscanner end
According to the document end command
should be there to push the analysis on Sonar cloud but pipeline fails by complaining that both begin and end command can not be together.
Here is my command … can you check what is wrong with this command. Note that this command works from my local and results are getting updated back in sonar cloud.
dotnet sonarscanner begin
/o:<org>
/k:<org_repo>
/d:sonar.host.url=https://sonarcloud.io
/d:sonar.login=${SONAR_TOKEN}
/d:sonar.cs.dotcover.reportsPaths=dotCover.Output.html
/d:sonar.verbose=true \
dotnet build \
dotnet dotcover test --dcReportType=HTML \
dotnet sonarscanner end /d:sonar.login=${SONAR_TOKEN}
Hi,
You appear to have line-continuation characters in your quoted command(s)…?
That puts all the commands: begin
, build
and end
in the same line, without even command separation characters between them.
Try it without the \
s.
Ann