Here is the powershell script for the build wrapper.
Note - that if I remove the /target:"clean;Build", it works, however this piece was added, as other projects that use this script were not working. the build-wrapper-dump.json file was empty if the build was not cleaned.
It’s an Azure DevOps pipeline, istn’t it? Then your cache in $(Agent.TempDirectory) will be wiped out after each pipeline as A temporary folder that is cleaned after each pipeline job., see Predefined variables - Azure Pipelines | Microsoft Docs
Therefore I use sonar.cfamily.cache.path=$(Agent.WorkFolder)/$(Build.Repository.Name).
Still, unfortunately not all cached files are grabbed.
and correct - the temp directory is wiped out after each build. I dont see this being an issue though, as I am storing the cached analysis files on a shared directory and am pulling them down to the temp directory on each build.
as I had already issues with a git bare repo on a network drive in the past, I would try to keep the cache on the build server - at least for testing. Not that backing up and restoring modifies anything on the cache (and if it is only access rights, or metadata in a separate file stream).
And then add for testing a script task to double check if the cache is on the temp directory just before the run SonarQube analysis task.