0

We are using Visual Studio 2015 (original release, no update) with SonarQube and Jenkins, and keep getting the message:

WARN - * The use of MSBuild 12 or the sonar-runner to analyze C# projects is DEPRECATED *

However, we are using MSBuild 14, SonarLint, and the SonarQube scanner for MSBuild. This is confirmed at the beginning of the log:

SonarQube Scanner for MSBuild Begin Step 2.0
Loading analysis properties from c:\Program Files (x86)\tools\MSBuild.SonarQube.Runner-2.1\SonarQube.Analysis.xml
15:25:15.073  Updating build integration targets...
15:25:15.079  Fetching analysis configuration settings...
15:25:15.51  Generating rulesets...
15:25:16.629  Provisioning analyzer assemblies...
15:25:16.63  Installing required Roslyn analyzers...

SonarQube Server is 5.1.2

We used the instructions at http://docs.sonarqube.org/display/SCAN/Analyzing+with+SonarQube+Scanner+for+MSBuild#AnalyzingwithSonarQubeScannerforMSBuild-msbuildcompat and the Jenkins integration http://docs.sonarqube.org/display/SCAN/From+Jenkins

I found the question SonarQube warning on MSBuild version but I think we are correctly using SonarLint. What is the cause of the deprecation message?

Community
  • 1
  • 1
Lothar May
  • 13
  • 3
  • As a second step of the analysis you are running MsBuild on your solution. In the first output line it shows the version MsBuild version number. Does it show something like `Microsoft (R) Build Engine version 14.0...`? – Tamas Jun 23 '16 at 08:43
  • It says: Microsoft (R)-Buildmodul, Version 14.0.23107.0 Copyright (C) Microsoft Corporation. Alle Rechte vorbehalten. (we are using the German version, Visual Studio 2015, no updates). – Lothar May Jun 23 '16 at 09:16
  • That seems good. The message is being written when we can't find the Roslyn generated output file for a project. (In this case we fall back to file-by-file anaysis.) Does MsBuild complete successfully? Can you access the Jenkins workspace? There's a `.sonarqube` folder next to your solution. In the `out` folder there are project specific folders, which contain `ProjectInfo.xml` files. Try to locate one (some) that doesn't have `ProjectInfo/AnalysisSettings/Property Name="sonar.cs.roslyn.reportFilePath"` XML entries to see which project caused problems. – Tamas Jun 23 '16 at 09:41
  • Thank you for the hint. We found out that most projects do have the XML entry, but there are some projects without the entry. The projects without the entry are unit test projects and one class library only used by unit test projects. So it seems that this problem is related to test projects. Do you have any hint on how to solve this? – Lothar May Jun 23 '16 at 12:06
  • I should note that these test projects are excluded in the server configuration by: `13:52:55.962 INFO - Excluded sources for coverage: 13:52:55.962 INFO - **/Projectname/**/*.cs` – Lothar May Jun 23 '16 at 12:17
  • We tried to exclude the unit test projects which did not get roslyn XML entries by using the "SonarQubeExclude"-tag. However, this did not help at all. We are still stuck with the same deprecation message. I'll see if I can create a sonarqube bugreport somewhere. – Lothar May Jun 30 '16 at 09:00
  • Would you mind posting on the SonarQube user group with a small reproducer (a sample project exposing this behavior)? – Julien H. - SonarSource Team Jun 30 '16 at 12:59

1 Answers1

0

We finally solved this issue by updating everything: We updated the C# plugin in Sonarqube and all Jenkins Plugins (including the msbuild plugin). After that, the deprecation message no longer occurs.

Lothar May
  • 13
  • 3