Search code examples
.net-coremsbuildsonarqube

SonarQube with .NET Core 1.1


After my team migrated completely to .NET Core 1.0 using SonarQube was sort of out of the picture, but then I read Running SonarQube against an ASP.Net Core solution/project where it is stated that, with Core 1.1, migrating from project.json to .csproj it might be possible to use MSBUILD to build the project(s) and run SonarQube analysis on the code.

Has anyone been able to pull this off? After we upgraded one of our solutions to Core 1.1 I've been trying to get SonarQube to analyse this code.

If tried both using msbuild /t:rebuild and different variations on dotnet msbuild

to build the project during the Sonar analysis but neither has produced anything other than SonarQube responding with the standard "make sure the build succeeded and that all SonarQube commands where run from the same folder" error.

This in spite of the fact that msbuild /t:rebuild does return a "build succeeded".


Solution

  • Two aspects here:

    • on the Microsoft side: I believe .csproj is now the de-facto format (see this Q&A). Old formats (.xproj,project.json) should be migrated to csproj using VS2017 toolset.
    • on the SonarQube side: .Net Core projects are supported starting from Scanner for MSBuild v2.3