Configured a local instance of SonarQube 7.2.1
Trying to analyze a solution targeting .Net 4.5.2
Getting the analysis only for the JavaScript files, nothing for the cs files, they are shown in the project but no results for them.
Getting a lot of messages like these in the build:
CSC : warning CS8032: An instance of analyzer SonarAnalyzer.Rules.CSharp.ThreadStaticWithInitializer cannot be created from C:\Users\user\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.. [\\Repositories\_GitHubRepo\.D\.D.csproj]
CSC : warning CS8032: An instance of analyzer SonarAnalyzer.Rules.CSharp.MutableFieldsShouldNotBePublicReadonly cannot be created from C:\Users\user\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.. [\\Repositories\_GitHubRepo\.D\.D.csproj]
CSC : warning CS8032: An instance of analyzer SonarAnalyzer.Rules.CSharp.GetHashCodeEqualsOverride cannot be created from C:\Users\user\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.. [\\Repositories\_GitHubRepo\.D\.D.csproj]
The dlls and assembly are in place.
And these warnings in the end step:
WARN: Property missing: 'sonar.cs.analyzer.projectOutPaths'. No protobuf files will be loaded for this project.
WARN: No roslyn issues report not found for this project.
WARN: Property missing: 'sonar.cs.analyzer.projectOutPaths'. No protobuf files will be loaded for this project.
WARN: No roslyn issues report not found for this project.
WARN: Analyzer working directory does not exist: 'D:\\Repositories\_GitHubRepo\.sonarqube\out\0\output-cs'. Analyzer results won't be loaded from this directory.
WARN: Analyzer working directory does not exist: 'D:\\Repositories\_GitHubRepo\.sonarqube\out\1\output-cs'. Analyzer results won't be loaded from this directory.
WARN: Analyzer working directory does not exist: 'D:\\Repositories\_GitHubRepo\.sonarqube\out\2\output-cs'. Analyzer results won't be loaded from this directory.
WARN: Too many duplication references on file /Scripts/jquery-1.10.2.intellisense.js for block at line 2. Keep only the first 100 references.
WARN: Too many duplication references on file /Scripts/jquery-1.10.2.intellisense.js for block at line 2. Keep only the first 100 references.
WARN: Too many duplication references on file /Scripts/jquery-1.10.2.intellisense.js for block at line 2. Keep only the first 100 references.
"C:\Program Files\sonarqube-7.2.1\sonnarscanner-msbuild\net46\SonarScanner.MSBuild.exe" begin /k:MyKey /d:sonar.verbose=true > BEGIN
"C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\MSBuild.exe" /t:Rebuild .\Solution.sln > BUILD
"C:\Program Files\sonarqube-7.2.1\sonnarscanner-msbuild\net46\SonarScanner.MSBuild.exe" end > END
Report on the C# code.
Only results for the JavaScript code.
Please provide a description of any known workarounds.
Please, let me know if there's more information needed to help diagnose.
Thanks in advance for your help!
Francisco.
Hi @franciscoarturoalonso,
If you look at the release notes of SonarC# 7.0 you will see that we talk about a breaking change which forces you to have at least VS2015 Update 3 or MSBuild 14 Update 3 (the latest available for download on Microsoft website).
The warnings you are referring to are because we rely on Roslyn 1.3.1 (Microsoft.CodeAnalysis) which is shipped by default with VS/MSBuild. As you don't have the correct version of VS/MSBuild then the analyzer is crashing.
Thanks for your quick response @Evangelink,
I have tried with these two MSBuild versions:
Microsoft (R) Build Engine version 14.0.23107.0
Microsoft (R) Build Engine version 15.6.82.30579 for .NET Framework (from Visual Studio)
And none seems to work, I'm still missing something there.
Hi @franciscoarturoalonso,
Sorry for this really late answer but I was off before. Could you check if one of your projects is referencing the Microsoft.Net.Compilers nuget? If so you need to update it to at least 1.3.1
If you still have any issue, could you try and create a small console app and analyze it to see if you also have the issue or not?
Cheers,
Amaury
Hello Amaury,
Thanks a lot for your time, right now I have to deal with a lot of other priorities, I guess I’ll open a new thread once I can start again on this, thanks again for your attentio, I really appreciate it.
Best regards,
Francisco Alonso.
From: Amaury Levé notifications@github.com
Sent: Monday, October 1, 2018 10:31 AM
To: SonarSource/sonar-csharp sonar-csharp@noreply.github.com
Cc: Arturo Alonso, Francisco (Cognizant) Francisco.ArturoAlonso@cognizant.com; Mention mention@noreply.github.com
Subject: Re: [SonarSource/sonar-csharp] C# code not analyzed - Version 7.3 (build 5690) (#1828)
Hi @franciscoarturoalonsohttps://github.com/franciscoarturoalonso,
Sorry for this really late answer but I was off before. Could you check if one of your projects is referencing the Microsoft.Net.Compilers nuget? If so you need to update it to at least 1.3.1
If you still have any issue, could you try and create a small console app and analyze it to see if you also have the issue or not?
Cheers,
Amaury
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHubhttps://github.com/SonarSource/sonar-csharp/issues/1828#issuecomment-425828427, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AoCcqatVIGftd9PHWJtrtt8OOYVL-FvAks5ugdLQgaJpZM4WXqOG.
This e-mail and any files transmitted with it are for the sole use of the intended recipient(s) and may contain confidential and privileged information. If you are not the intended recipient(s), please reply to the sender and destroy all copies of the original message. Any unauthorized review, use, disclosure, dissemination, forwarding, printing or copying of this email, and/or any action taken in reliance on the contents of this e-mail is strictly prohibited and may be unlawful. Where permitted by applicable law, this e-mail and other e-mail communications sent to and from Cognizant e-mail addresses may be monitored.
Hi @franciscoarturoalonso,
Sorry for this really late answer but I was off before. Could you check if one of your projects is referencing the
Microsoft.Net.Compilersnuget? If so you need to update it to at least 1.3.1If you still have any issue, could you try and create a small console app and analyze it to see if you also have the issue or not?
Cheers,
Amaury
Thanks a lot. It takes my three days to solve the problem.My project is built in VS2017,and my sornarQube's version is 7.8.