"Solution with a Mix of C# and C++" how to?

Finally!

I started out with a functional c# setup.

Sonarqube supply the c-family build wrapper exe by a link to your sonarqube server:
{SonarQube URL}/static/cpp/build-wrapper-win-x86.zip - unzipped it and put the exe in program files on build server.

Added the line:
sonar.cfamily.build-wrapper-output=$(SonarOutDir)
to Build process → Prepare analysis on SonarQube → Advanced → Additional Properties

Added an inline powershell script (thanks to @milbrandt ) to build process instead of the Visual Studio Build plugin, notice I used extra msbuild arguments after VisualStudioVersion, that you might not, and remember to get the version right, I used VS 2017 which is v.15, on my build server:

New-Item -Path $(SonarOutDir) -ItemType directory -Force Set-Location $(SrcDir) & "$(build_wrapper)" --out-dir $(SonarOutDir) "$(msbuildPath)\MSBuild.exe" $(SrcDir)\Solution.sln /t:Rebuild /nologo /nr:false /t:"Clean" /p:FullRelease=true /p:platform=$(BuildPlatform) /p:configuration=$(BuildConfiguration) /p:VisualStudioVersion="15.0" /p:AppxBundlePlatforms="$(BuildPlatform)" /p:AppxPackageDir="$(Build.ArtifactStagingDirectory)\AppxPackages\\" /p:AppxBundle=Always /p:UapAppxPackageBuildMode=StoreUpload /m

All the variables used above needs to be set in TFS 2018 UI as so. Make sure build_wrapper path matches where you put it, and find the path to your version of msbuild.exe:

1 Like