Yes.
Hi @nmathieu
Which version of MSBuild are you using ? What does contain the task group ? is there any “standard” msbuild task on it ?
Thanks.
Do you see any kind of Sonar-related logs in this build solution task ?
Hi @nmathieu
Sorry for the late reply.
I noticed some inconsistency between the auto-generated folder when building. For instance, on your last build log, it says “D:\agent_work\64\s” and on the run code analysis logs, analysis is made on “D:\agent_work\60\s”. Is that on purpose ? Can you check that on your full pipeline execution, everything goes in the same folder ?
Thanks.
Thanks for the logs. It looks like the Sonar Scanner for MSBuild targets are being executed during the build, but for some reason the SonarC# analyzer is not being executed. The SonarC# analyzer is responsible for calculating the lines of code per file as well as raising analysis issues, which is why no lines of code are being reported in SonarQube.
To help work out what is happening, could you try the following please?
-
temporarily remove your
.editorconfig
file and run the CI build to see if that makes a difference. -
with the
.editorconfig
present, run a CI build with diagnostic logging enabled and send us the build logs (i.e. pass/v:diag
as argument to MSBuild). That should give us a better idea of why csc.exe is not executing the SonarC# analyzer. If you could share your.editorconfig
file that would also be useful.
Thanks.
Hello,
the file .editorconfig present in the solution?
Thx
Yes; from the logs it looks like it is at the root of the source folder.
I upgrade sonarqube to version 8.5.
without the .editorconfig the warning is different:
WARN: Your project contains C# files which cannot be analyzed with the scanner you are using. To analyze C# or VB.NET, you must use the Scanner for MSBuild 4.x, see https://redirect.sonarsource.com/doc/install-configure-scanner-msbuild.html.
After deleting I cannot find the .editorconfig file, who generates it?
The final message was changed in SQ 8.5. Since you use Scanner for MsBuild, this message is a side effect of the C# analyzer not being triggered during the csc build.
Do you have any *.targets
files in your solution?
.editorconfig
is usually added manually. VS can generate it when you do some configuration changes. You should check your backup to see the original file.
yes, I have a lot of * .targets file.
In particular one concerning my target project:
Nova.Model.csproj.nuget.g.targets
<?xml version="1.0" encoding="utf-8" standalone="no"?> $(MSBuildAllProjects);$(MSBuildThisFileFullPath)Thanks for the detailed logs.
According to the logs, the Sonar analyzers are being removed by the standard Microsoft target DisableAnalyzers
. My guess is that you are setting RunAnalyzersDuringBuild
or RunAnalyzers
to false
somewhere in your project/target files.
Try adding /p:RunAnalyzersDuringBuild=true
is the MSBuild Arguments
section of the Azure DevOps build step.
I love you
It work .
FYI there’s a ticket in the scanner backlog (#829) to look at handling this situation automatically.
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.