When we have the branch name with the -improve- within its name we get the following error from the command “SonarScanner.MSBuild.exe end /d:sonar.login={TOKEN HERE}”
Error:
INFO: Load project pull requests (done) | time=83ms
INFO: Load branch configuration
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 14.015s
INFO: Final Memory: 19M/74M
INFO: ------------------------------------------------------------------------
powershell.exe : ERROR: Error during SonarScanner execution
At D:\jenkins1\workspace\3217-improve-load-for-edit-event@tmp\durable-c594c053\powershellWrapper.ps1:3 char:1
I can’t repro this locally - running the following commands from the command line works correctly for me:
SonarScanner.MSBuild.exe begin -d:sonar.branch.name=xxx-improve-msbuild -d:sonar.login=redacted -d:sonar.password=redacted -k:junk
msbuild /t:rebuild
SonarScanner.MSBuild.exe end -d:sonar.login=redacted -d:sonar.password=redacted
The version of the Scanner for .NET you are using must be quite old if it is using SonarScanner v4.4.0.2170 internally. Try updating to the latest version of the Scanner for .NET. I wouldn’t expect it to make a difference, but it might.
Can you successfully uses dashes in the branch name if you call the SonarScanner.MSBuild.exe from the command line? If so, it suggests there is a problem with the way the arguments are being escaped in your PowerShell script.