No analysis done when using sonar-scanner-msbuild y Jenkins

I’m doing an analysis with a project in C # with Jenkins integrated with sonar-scanner and sonarqube to show the results. The problem is that when trying to access the directory: Local analyzer cache: C: \ Windows \ .sonarqube \ resources, it does not have permissions, in fact the temporary directory should be C: \ Users \ srvc_jnks \ AppData \ Local \ Temp \ .sonarqube \ resources but I do not know how to configure this directory.
Thank you very much.

  • versions used (SonarQube: Version 6.7 (build 33306 : Jenkins: Jenkins ver. 2.121.2, Sonar Scanner : sonar-scanner-msbuild

  • error observed


SonarScanner for MSBuild 4.3.1
Using the .NET Framework version of the Scanner for MSBuild
Default properties file was found at D:\sonar\scanner\msbuild-\SonarQube.Analysis.xml
Loading analysis properties from D:\sonar\scanner\msbuild-\SonarQube.Analysis.xml
sonar.verbose=true was specified - setting the log verbosity to 'Debug'
Pre-processing started.
Preparing working directories...
Using environment variables to determine the download directory...
Removing the existing directory: D:\jnks\workspace\crm_empleo\.sonarqube
Creating directory: D:\jnks\workspace\crm_empleo\.sonarqube
13:21:03.394  13:21:03.361  Loading analysis properties from D:\sonar\scanner\msbuild-\SonarQube.Analysis.xml
13:21:03.394  13:21:03.394  sonar.verbose=true was specified - setting the log verbosity to 'Debug'
13:21:03.413  Updating build integration targets...
13:21:03.42  The file SonarQube.Integration.ImportBefore.targets is up to date at C:\Users\srvc_jnks\AppData\Local\Microsoft\MSBuild\4.0\Microsoft.Common.targets\ImportBefore
13:21:03.422  The file SonarQube.Integration.ImportBefore.targets is up to date at C:\Users\srvc_jnks\AppData\Local\Microsoft\MSBuild\10.0\Microsoft.Common.targets\ImportBefore
13:21:03.437  Installed SonarQube.Integration.targets to D:\jnks\workspace\crm_empleo\.sonarqube\bin\targets
13:21:03.44  Creating config and output folders...
13:21:03.442  Creating directory: D:\jnks\workspace\crm_empleo\.sonarqube\conf
13:21:03.443  Creating directory: D:\jnks\workspace\crm_empleo\.sonarqube\out
13:21:03.466  Fetching analysis configuration settings...
13:21:03.771  Fetching active rules for quality profile 'AWPKCU9d4uXu8gn2ZBwN' from http://xxxx.xxxxx.xx9000/sonarcalidad/api/rules/search?f=repo,name,severity,lang,internalKey,templateKey,params,actives&ps=500&activation=true&qprofile=AWPKCU9d4uXu8gn2ZBwN&p=1...
13:21:03.938  Fetching rules not active in quality profile 'AWPKCU9d4uXu8gn2ZBwN' for language 'cs' from http://xxxx.xxxxx.xx9000/sonarcalidad/api/rules/search?f=internalKey&ps=500&activation=false&qprofile=AWPKCU9d4uXu8gn2ZBwN&p=1&languages=cs...
13:21:03.939  Downloading from http://xxxx.xxxxx.xx:9000/sonarcalidad/api/rules/search?f=internalKey&ps=500&activation=false&qprofile=AWPKCU9d4uXu8gn2ZBwN&p=1&languages=cs...
13:21:04.006  Local analyzer cache: C:\Windows\.sonarqube\resources
Unhandled Exception: System.UnauthorizedAccessException: Access to the path 'C:\Windows\.sonarqube\resources' is denied.
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.Directory.InternalCreateDirectory(String fullPath, String path, Object dirSecurityObj, Boolean checkHost)
   at System.IO.Directory.InternalCreateDirectoryHelper(String path, Boolean checkHost)
   at SonarScanner.MSBuild.PreProcessor.Roslyn.EmbeddedAnalyzerInstaller..ctor(ISonarQubeServer server, String localCacheDirectory, ILogger logger)
   at SonarScanner.MSBuild.PreProcessor.PreprocessorObjectFactory.CreateRoslynAnalyzerProvider()
   at SonarScanner.MSBuild.PreProcessor.TeamBuildPreProcessor.FetchArgumentsAndRulesets(ISonarQubeServer server, ProcessedArgs args, TeamBuildSettings settings, IDictionary`2& serverSettings, List`1& analyzersSettings)
   at SonarScanner.MSBuild.PreProcessor.TeamBuildPreProcessor.DoExecute(ProcessedArgs localSettings)
   at SonarScanner.MSBuild.BootstrapperClass.PreProcess()
   at SonarScanner.MSBuild.BootstrapperClass.Execute()
   at SonarScanner.MSBuild.Program.Execute(String[] args, ILogger logger)
   at SonarScanner.MSBuild.Program.Main(String[] args)
WARN: Unable to locate 'report-task.txt' in the workspace. Did the SonarScanner succedeed?
ERROR: Execution of SonarScanner for MSBuild failed (exit code 255)
Finished: FAILURE

Hi @Alcayde,

Could you let me know which user is running the analysis? Also it seems that the user temp folder path contains some illegal characters, could you let us know what’s the path for %TEMP% on the user running the analysis?

Hi Ammo.
Thank you very much for your reply.
The user that launches the analysis is srvc_jnks and the variable TEMP is
c: \ Users \ SRVC_J ~ 1 \ AppData \ Local \ Temp \ 7