Sonar Scanning - Visual Studio - Cannot run program CreateProcess error=267, The directory name is i

My project is built using VS 2019.
I run the build with a wrapper:
build-wrapper-win-x86-64.exe --out-dir bw-output <build command>
and then I run the sonar scanning:
sonar-scanner.bat -X -D"sonar.organization=XXXX" -D"sonar.projectKey=XXXX" -D"sonar.sources=." -D"" -D"" -D""

And I get the following error:
06:17:01.926 ERROR: Error during SonarScanner execution
java.lang.IllegalStateException: Cannot run program “C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\bin\Hostx64\x86\cl.exe” (in directory “D:\tmp\develop\tmclient\out_stealth”): CreateProcess error=267, The directory name is invalid

Please Help!

Hey there.

Just as a first check, does this executable exist at this location on your machine running analysis?

Hi, thanks for the response!
Yes, the binary exists.

hi @Oleg_Trofimov,

This error means that the directory D:\tmp\develop\tmclient\out_stealth was used during the build but didn’t exist during the analysis. Do you confirm that? Do you know why it was cleaned before the analysis? Can you try to avoid cleaning it and rerun the analysis?


Hi! thanks for pointing me to the idea, that some folder might be deleted.
That’s true, after the build we delete some folders and it was the issue! Thanks a lot!

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.