How to use Unity3D + Jenkins + SonarQube? [Begginer]

Hi guys,

I am trying to develop a complete pipeline for my Unity3D projects.
I’ve installed the latest SonarQube version 7.7 (Which I know that contains some fixes for Unity3d projects, at least that is what I’ve read until now.) on a Windows 10 x64 system.

After following the guide from SonarQube-Jenkins-guide official documentation, I’ve managed to install and configure it (Setup the SonarServer and SonarScanner, SonarQube jenkins plugin.)

However, there are still some knowledge gaps for me, for example:

  • What the should contain for Unity 3D C# projects?
  • Will the following command be ennough trigger the Code Analysis, Quallity gate tasks?
     def scannerHome = tool 'SonarQube Scanner 2.8';
     withSonarQubeEnv('My SonarQube Server') {
       sh "${scannerHome}/bin/sonar-scanner"
  • Do I have to setup different tasks using the command line? What kind of tasks are there?

I appreciate any begginer tips, guides and docs you may have at hand which can help me understand how to setup SonarQube for this kind of Unity3D projects.
If anyone has a template of for Unity 3d projects that could also help me understand what it actually needs defined in that file for this kind of projects.


I think you should try to understand each pieces of the puzzle separately before trying to plug everything together.

For all C# projects, you should use the “SonarQube Scanner for MSBuild” and forget the raw SonarScanner. There is no to manually provide, the “SonarQube Scanner for MSBuild” is handling it. So you should follow this documentation:

Once you will be able to scan your local copy of your project with the “SonarQube Scanner for MSBuild” and send the results to your SonarQube 7.7, then it will be the time to think about automating things with Jenkins.


1 Like

i have actually tried to set it up, but it did not work for me right now.
Unity (for a lot of time, until very recently), was using .NET 3.5 (well, technically it’s Mono) and only recently was upgraded to support something that is ‘compatible’ with modern .Net and C# language versions.

Our project still uses .net 3.5 profile and as such when trying to run the SonarQube scanner for MSBuild, it fails since it cannot find the .NET framework assemblies for v3.5.

I installed the .Net core version of the Sonarqube scanner, and i am executing the scan on a Mac Mini machine (OSX). It would be great if someone could give any words of advice as to how to set this up.

Any progress in managing sonar for your project?
Let me know how it goes and maybe we can help each other to get this working.
Maybe also document this for the community.

1 Like

I suggest you to look at this page:

The Sonar Scanner for MSBuild requires your project to be built with MSBuild 14.0. We recommend installing Visual Studio 2015 update 3 or later on the analysis machine in order to benefit from the integration and features provided with the Visual Studio ecosystem (VSTest, MSTest unit tests, etc.).

Projects targeting older versions of the .NET Framework can be built using MSBuild 14.0 by setting the " TargetFrameworkVersion " MSBuild property as documented by Microsoft:

Are you able to build your project using MSBuild 14.0, using a compatibility mode for v3.5?

I was actually able to get it running with Unity.
Most of my issues of setting it up are historic, and were a result of tying to set it up to run on a Mac.

Everything works fine and is very easy to set up - i am using the SonarQube scanner for MSBuild (choose the .NET framework option). Just run it exactly as the docs say.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.