dotnet sonarscanner begin \
/o:centralpoint \
/k:centralpoint.io_order-usecase \
/d:sonar.host.url=https://sonarcloud.io
<insert_your_build_command>
dotnet sonarscanner end
Languages of the repository (C#)
Following error is thrown:
Failed to load /opt/homebrew/Cellar/dotnet/8.0.4/libexec/host/fxr/8.0.4/libhostfxr.dylib, error: dlopen(/opt/homebrew/Cellar/dotnet/8.0.4/libexec/host/fxr/8.0.4/libhostfxr.dylib, 0x0001): tried: '/opt/homebrew/Cellar/dotnet/8.0.4/libexec/host/fxr/8.0.4/libhostfxr.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64')), '/System/Volumes/Preboot/Cryptexes/OS/opt/homebrew/Cellar/dotnet/8.0.4/libexec/host/fxr/8.0.4/libhostfxr.dylib' (no such file), '/opt/homebrew/Cellar/dotnet/8.0.4/libexec/host/fxr/8.0.4/libhostfxr.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64'))
The library libhostfxr.dylib was found, but loading it from /opt/homebrew/Cellar/dotnet/8.0.4/libexec/host/fxr/8.0.4/libhostfxr.dylib failed
- Installing .NET prerequisites might help resolve this problem.
Now, I found the build and I am able to run the sonar scanner from local and it is able to push the analysis to Sonar cloud.
The exact same command does not work in Gitlab pipeline. I keep on getting this error Invalid command line parameters. Please specify either 'begin' or 'end', not both.
If I remove the end command, then SONAR analysis is done successful but analysis is not integrated[pushed] to sonar cloud. I do not see the results in there.
Here is the command I am using
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}