I need to perform static code analysis of .NET project using SonarQube.
I have 2 machines:
- Linux with Sonar Server
- Windows with .net code and its tools (Fxcop, …)
I need to perform analysis on Windows and push the results to Sonar Server on Linux machine.
Can someone help me with this?
Advertisement
Answer
First you need to have the appropriate plugins installed in your SonarQube server, so C# if it’s not there already.
Then you’ll install SonarQube Scanner for MSBuild on the Windows machine, and run the analysis there because full/proper analysis of .NET code requires MSBuild and that’s not gonna work on Linux. Don’t worry, there’s no problem running the analysis on a different machine than the one that hosts your SonarQube server.
Essentially, you set up a build step to eavesdrop on the MSBuild execution, then you run the analysis based on the data gathered during the build.
Full details in the docs.