Sample project used to build a C/.net project and send information to sonarqube server.
##Jenkins configuration: Jenkins must have SonarQube server and SonarScanner for MSBuild configured to be able to run SonarQube scans and send reports to the server.
This step must be done in every Jenkins Controller that will use this node to run builds and send reports to SonarQube server.
- Navigate to Jenkins//Manage Jenkins/Configure system
- Under 'SonarQube servers' click 'Add SonarQube' to add a new entry called 'SonarQubeMSBuild' with our production SonarQube server info
- Save
This step must be done in every Jenkins Controller that will use this node to run builds and send reports to SonarQube server.
- Navigate to Jenkins//Manage Jenkins/Global Tool Configuration
- Under 'SonarScanner for MSBuild' Click 'Add SonarScanner for MSBuild' to add a new installation
- Save
Install build-wrapper:
- Download it from https:///static/cpp/build-wrapper-win-x86.zip
- Unzip it to the desired folder
- Add it to the PATH environment variable
After the first Jenkins pipeline run, Jenkins will install the SonarScanner for MSBuild Global files under: /tools. Example:
The pipeline refered in the Jenkinsfile in this repo would build the projects and send reports to SonarQube server. NOTE: It makes the build time to increase a lot. Maybe due to the process of indexing the files to send reports.
https://docs.sonarqube.org/latest/analysis/scan/sonarscanner-for-msbuild/ https://docs.sonarqube.org/latest/analysis/languages/cfamily/ https://docs.sonarqube.org/latest/analysis/scan/sonarscanner-for-jenkins/ https://docs.sonarqube.org/latest/analysis/scan/sonarscanner-for-msbuild/ https://stackoverflow.com/questions/58558449/sonarscanner-msbuild-tool-is-not-running-in-pipeline-jenkins https://community.sonarsource.com/t/sonarscanner-msbuild-exe-and-build-wrapper-win-x86-64-exe/25460 https://community.sonarsource.com/t/sonarcloud-with-msbuild-build-wrapper-on-github-actions/35607 https://community.sonarsource.com/t/jenkins-declarative-pipeline-with-sonarcube-and-msbuild/36964