Download msbuild-database.zip archive from release page
Unzip to folder
Add path to msbuild-database.dll as logger
Example msbuild -logger:/path/to/msbuild-database.dll /t:Rebuild MyProject
/t:Rebuild- to recompile the entire project and get a list of all compilation commands
dotnet build