It is not located in project basedir

I am using CMake to generate Visual studio solution file and the build directory which has VS solution file (*.sln) is different from the source directory. For example, my source directory is at E:\Source\Project and my build directory is at E:\Buid\Project.

The scanner is executed at the build directory like this:
C:\Users\admin.sonar\sonar-scanner-\bin/sonar-scanner.bat -D"sonar.organization=xxxxx" -D"sonar.projectKey=xxxxx" -D"sonar.sources=E:/Source/Project" -D"" -D"" -X

It only processes generated files under the build directory but it ignores all source under the source directory. The log shows this messages " It is not located in project basedir …" with files ignored.

I find that there is nothing in build-wrapper-dump.json.

# (C) SonarSource SA, 2014-2022,
# All SONARSOURCE programs and content are copyright protected.
# SONARSOURCE and SONARQUBE are trademarks of SonarSource SA. All rights are expressly reserved.
# This file is designed exclusively for use with the SONARSOURCE C / C++ / Objective-C Plugin.
# It may not be used in connection with any other software.
# Any other use is prohibited by law and may be grounds for immediate termination of your License.

It is generated with the command below.

%SONAR_DIRECTORY%/build-wrapper-win-x86/build-wrapper-win-x86-64.exe --out-dir bw-output msbuild -nodeReuse:False MyProject.sln


Are you doing a full / re-build? Every file needs to be compiled while the build wrapper is eavesdropping.


Thank you. Finally it generated build-wrapper-dump.json with rebuild option. I also ran the scanner from my source directory, not from build directory, then the message was gone.

1 Like

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