简体   繁体   中英

Why is Sonarqube not analyzing .Net 4.5 c# code

In my organization we have several projects. Some are in .Net 4.5 and other are been migrated to .Net Core.

All the projects go through a GOcd pipeline for delivery. This pipeline includes Sonarqube analysis.

The problem is that sonar is not analyzing the c# code of projects that are referencing .NET 4.5. The .Net Core projects are analysed as expected, but the 4.5 ones only get analyses on javascript, xml, css, etc... and not the actual c# code.

There are no errors/ warnings being logged. Any ideas?

Details:
-Sonar 7.3
-Scanner 2.2
-MSBuild 14

Edit1:
Actually there are several warnings going on, so i created a empty project using the default asp.net mvc project for .net 4.5 and ran it through the pipeline... most of the warnings are

|15:02:31.034      2>CSC : warning CS8032: An instance of analyzer SonarAnalyzer.Rules.CSharp.SOMETHING cannot be created from C:\Users\TFS-SVC\AppData\Local\Temp\.sonarqube\.static\csharp_7.3.2.6129\SonarAnalyzer-7.3.2.6129.zip\SonarAnalyzer.CSharp.dll : 
Could not load file or assembly 'Microsoft.CodeAnalysis, Version=1.3.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. 
The system cannot find the file specified.. [D:\Go\Agent\pipelines\Sonar_Teste_Build\POC.Net4.5andSonarQube\POC.Net4.5andSonarQube.csproj]`

Edit2:
I installed Microsoft.CodeAnalysis 1.3.1 and Microsoft.CodeAnalyses.CSharp 1.3.1 nuget packages but the warnings persist and only javascript and CSS gets analysed

I'm using VSTS pipeline and Sonar C# 7.15 but my C# code is not getting analyzed. I found that it requires MSBuild version 14+ but where do I specify in VSTS pipeline.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM