Build-wrapper does not include referenced projects althoug MS Build builds them

I have application that uses dll/lib dependency projects. build wrapper invokes MS Build and every project is built. build wrapper cptures only source files of main application (because it is working directory where I run command).

Hello @zdenko-s and welcome to our community!

To better understand your issue, could you share build-wrapper.log, build-wrapper-dump.json, and the exact command you used to run the build wrapper? If you prefer to send them privately, I can send you a PM.

I created test project to reproduce behaviour. I have zip file.
Please run build-wrapper and build App\App.vcxproj. Msbuild will invoke build of dependency DynamicLib\DynamicLib.vcxproj. Please look at console output. When build completes, take a look at build-wrapper generated json file. It should contain files compiled by cl.exe.
cpp.zip (8.7 KB)

Are you doing a clean build? It’s important to do so, or build-wrapper cannot capture all build commands. See the example in Analysis Steps Using Build Wrapper.

build-wrapper-win-x86-64.exe --out-dir outputdir MSBuild.exe /t:Rebuild

If you still face issues, please share the two files build-wrapper.log and build-wrapper-dump.json. Without those, it’s hard to provide accurate help.

First, I run /t:Clean, next, I run build-wrapper msbuild /t:build
I shared with you source project with all files. You can easily reproduce behaviour. Please use App as working directory. From console output, you could see that msbuild cleaned reference project too.
msbuild /t:Clean /p:Configuration=Release /p:Platform=Win32 App.vcxproj
Done Building Project “C:\dev\SonarQube\cpp\DynamicLib\DynamicLib.vcxproj” (Clean target(s)).
Done Building Project “C:\dev\SonarQube\cpp\App\App.vcxproj” (Clean target(s)).

Next, is build-wrapper

I added msbuild console output to zip file too.
bw-output.zip (12.3 KB)
I think problem is in source-analyser. I searched for “.cpp” in build-wrapper-dump.json and there are 4 occurrences. Referenced project source path is added as relative path:

Line 63: pch.cpp],
Line 237: dllmain.cpp],
Line 404: ..\\Shared\\SharedSource.cpp,
Line 405: App.cpp],

Hello @zdenko-s,

I tried your project. It captures 4 files. That is the expected behavior of build-wrapper. It captures the set of source files compiled by your command and in your case, MSBuild builds 4 files and build-wrapper captures all of them.

Where is the problem?

Thanks,