VB .NET not analyzed, An instance of ... cannot be created from ...SonarAnalyzer.VisualBasic

(Dominik Montada) #1

Hi. I’m using Sonarqube 7.5 with Azure DevOps Server 2019 RC2 and Visual Studio 2015 Update 3. SonarVB is running 7.10 (build 7896)

I have a VB .NET MVC project which is built and analyzed with Azure DevOps. During built I get multiple errors of the following kind:

Warning BC42376: An instance of analyzer SonarAnalyzer.Rules.VisualBasic.FlagsEnumWithoutInitializer cannot be created from C:\Users\svadmin.SRSDEVOPS\AppData\Local\Temp\.sonarqube\resources\1\SonarAnalyzer.VisualBasic.dll : ファイルまたはアセンブリ 'Microsoft.CodeAnalysis, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35'、またはその依存関係の 1 つが読み込めませんでした。指定されたファイルが見つかりません。.

I found other topics where similar problems where being discussed and from there, as well as the release notes, I know that Visual Studio 2015 Update 3 (MSBuild v14.0.25431.01), as well as .NET Framework 4.6+ is required.

However, I am already running them: VS2015 Update 3 with .NET Framework 4.7.03062 is already running on my build agent, with the newest SonarVB plugin installed on my SonarQube server.

The problem is not limited to VB .NET. C# projects are also affected by this (although this was to be expected).

Everything not .NET related (JavaScript, CSS, HTML) is analyzed normally.

Any idea how to solve this?

(Dominik Montada) #2

So I figured it out. I was using the project template from Microsoft for testing and it turns out that by default they add the Microsoft.Net.Compilers 1.0.0 package. This of course causes the project to be built with Roslyn 1.0.0, which is not supported in the newest SonarQube, causing the build to fail. After removing the package everything started working!