Open duncanp-sonar opened 2 years ago
Alternative approach (requires more testing)
Run the begin
and end
steps from the same directory (the "scanner working directory").
The working directory for the build step can be different, as long as it is told where the scanner working directory is.
e.g.
:: Change to the directory to be used as the scanner working directory
cd D:\Junk\ScannerTest
call d:\Tools\scanner\latest\net46\SonarScanner.MSBuild.exe begin /d:sonar.login=%1 /k:duncanp_junk /d:sonar.host.url=https://sonarcloud.io /o:duncanp-sonar-test
:: Change to the build directory, and tell MSBuild where the scanner working directory is
cd D:\support\scanner\CSNetClassLib1
msbuild /t:rebuild /p:SonarQubeBuildDirectory=D:\Junk\ScannerTest
:: Switch back to the scanner working directory for the end step
cd D:\Junk\ScannerTest
d:\Tools\scanner\latest\net46\SonarScanner.MSBuild.exe end /d:sonar.login=%1
Description
The docs don't make it clear that the
begin
, MSBuild andend
steps have to executed from the same directory (data is passed between the stages by writing files in subfolders relative to the working directory, so changing the working directory means the files won't be found).Related community thread