Sonarqube为什么不分析.Net 4.5 c#代码

时间:2018-11-08 12:09:08

标签: c# sonarqube

在我的组织中,我们有几个项目。有些在.Net 4.5中,而另一些已迁移到.Net Core。

所有项目都通过GOcd管道进行交付。该管道包括Sonarqube分析。

问题是声纳没有分析引用.NET 4.5的项目的c#代码。 .Net Core项目按预期进行了分析,但是4.5个项目仅能对javascript,xml,css等进行分析,而不能对实际的c#代码进行分析。

没有记录错误/ 警告。有什么想法吗?

详细信息:
-声纳7.3
-扫描仪2.2
-MSBuild 14

Edit1:
实际上有几种警告正在进行,因此我使用.net 4.5的默认asp.net mvc项目创建了一个空项目,并将其运行在管道中...大多数警告是

|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:
我安装了Microsoft.CodeAnalysis 1.3.1和Microsoft.CodeAnalyses.CSharp 1.3.1 nuget程序包,但警告仍然存在,并且仅对javascript和CSS进行了分析

1 个答案:

答案 0 :(得分:1)

我正在使用VSTS管道和Sonar C#7.15,但我的C#代码没有得到分析。我发现它需要MSBuild 14+版本,但我在VSTS管道中的哪里指定。