SonarScanner for MSBuild

Hi,
Need some help here. I am trying to publish some results over a C# project on a remote SonarQube server and I am constantly getting “errorMessage”:“Java heap space” in the report task. I am using
sonar-scanner-msbuild-4.6.2.2108-net46 and I have tried most of the suggestions found over the internet :

  • setting SONAR_SCANNER_OPTS to a bigger value
  • excluding *.doc *.docx files

My .bat file looks something like this :

set SONAR_SCANNER_OPTS=-Xmx3G -Xms512m -XX:+HeapDumpOnOutOfMemoryError -Djava.net.preferIPv4Stack=true
SonarQube.Scanner.MSBuild.exe begin /k: /d:sonar.host.url= /d:sonar.login= /d:sonar.exclusions=/*.doc,/.docx,**/.ipch
/t:Rebuild
SonarQube.Scanner.MSBuild.exe end /d:sonar.login=
cmd /k

It is strange that with local Sonar Qube server it worked and it posts the results but when trying to add a remote server it fails with the above error.

Any suggestions?

Thank you!