- which versions are you using
- what are you trying to achieve
run sonarscanner on a unity project (.net 4.7.1) with mono inside a docker container
- what have you tried so far to achieve this
built a docker image like this:
- built from unityci/editor:2020.3.1f1-android-0.15, then install mono-devel
- downloaded from
https://github.com/SonarSource/sonar-scanner-msbuild/releases/download/220.127.116.11033/sonar-scanner-msbuild-18.104.22.168033-net46.zip, unzip, make executable, add /sonar-scanner-22.214.171.1242/bin to PATH
the image builts fine and everysthing works so far.
Now the following is part of a bash script which is executed by gitlab ci inside a container with that image:
sonar-scanner -X \ -D sonar.projectKey="$SONAR_PROJECT_KEY" \ -D sonar.host.url="$SONAR_HOST_URL" \ -D sonar.login="$SONAR_TOKEN" \ -D sonar.projectVersion="$CI_PIPELINE_ID" \ -D sonar.exclusions=../Assets/**/Plugins/**/* \ begin msbuild ../Assembly-CSharp-Editor.csproj msbuild ../Assembly-CSharp.csproj sonar-scanner -D sonar.login="$SONAR_TOKEN" end
The first command fails stating
ERROR: Unrecognized option: begin
INFO: usage: sonar-scanner [options]
INFO: -D,–define Define property
INFO: -h,–help Display help information
INFO: -v,–version Display version information
INFO: -X,–debug Produce execution debug output
It took me some time to even get the command to not fail with a -k or -v option - because these are also invalid. I cannot find any guide or tutorial regarding this weird version of the sonar-scanner, everything I see looks entirely different.
Do I have a wrong version of the scanner? Or how am I supposed to use that one?