Hi all,
We are trying to analyse our solutions using SonarQube. Besides using the default SonarScanner C# rules, we have developed a few custom rules using Roslyn SDK specific to our domain and were able to test them locally against our projects.
We are running this on the CI server using Jenkins within Docker containers and since they are being executed within Docker containers, Docker always starts from a fresh image so there should not be any cache related issues.
We tested it against multiple Quality Profiles -
- containing only default C# rules,
- containing a mix of default C# and custom rules
- containing only custom rules
but in case of second quality profile, only the default rules were applied and in case of the third one, none were applied.
We have spent a considerable amount of time to understand and troubleshoot the issue but to no luck.
SonarQube version - Developer edition V7.9.1 (build 27448)
Custom Analysers project -
Visual Studio Enterprise 2017 v15.9.18 used
.NET Standard 2.0 used
Microsoft.CodeAnalysis.dll v1.3.0 used
Roslyn 2.10.0.0 used
Roslyn Plugin Generator v2.0 used
Error logs,
3>CSC : warning CS8032: An instance of analyzer SonarAnalyzer.Rules.CSharp.FrameworkTypeNaming cannot be created from C:\Users\ContainerAdministrator\AppData\Local\Temp.sonarqube\resources\0\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… [C:…csproj]
Steps tried for troubleshooting:
- Tried using Microsoft.CodeAnalysis.dll v2.2.0 and MSBuild v15.0 - didn’t work
- Degraded the version of Microsoft.CodeAnalysis.dll to v1.3.0 (as expected by the error) and MSBuild v14.0 - didn’t work
- Tried to check the expected versions of Microsoft.CodeAnalysis.dll from other DLLs that are provided by SonarQube like SonarAnalyzer.Security etc. and use the same in our custom analyser project but that also didn’t help.