Just wanted to say I did get this working eventually, its not a clean solution but it works. However I think its clear that this isnt a smooth onboarding. Also, as soon as I got it working, I have hit the following issue:
This has rendered the feature a bit useless for our use case unfortunately.
For reference for others:
steps:
- checkout: self
clean: true
- powershell: |
# move all your code
Get-ChildItem -Path $env:BUILD_SOURCESDIRECTORY -Force | ForEach-Object { Move-Item -Path $_.FullName -Destination ('C:\staticAgentPath\' + $_.Name) }
- task: SonarQubePrepare@4
inputs:
extraProperties: |
sonar.projectBaseDir=C:\staticAgentPath\
# and the rest
- powershell: |
# modify $env:AGENT_BUILDDIRECTORY\.sonarqube\conf\SonarQubeAnalysisConfig.xml
# add sonar.projectBaseDir property to the "LocalSettings" node
# change AnalysisConfig.SourcesDirectory to C:\staticAgentPath\ also
- powershell: |
# build
workingDirectory: 'C:\staticAgentPath\'
- task: SonarQubeAnalyze@4
- task: SonarQubePublish@4