Closed armourshield closed 5 years ago
@armourshield I've just unfolded new ASP.Net 2.1 and 2.2 projects and analysed them from the command line using:
dotnet sonarscanner begin...
dotnet build
dotnet sonarscanner end
... and both projects were analysed as expected (i.e. results for JS, CSS, HTML and C#)
Questions:
dotnet build
? (although I'd expect called MSBuild.exe directly to work too)dotnet build
, and also with a different version of MSBuild.exeOk. If the expected files are in listed FilesToAnalyze.txt
then it means the Sonar targets were correctly picked up during the build phase and they collected the data correctly.
.sonarqube\out\sonar-project.properties
?/d:sonar.verbose=true
to the begin
step and run the analysis steps again. Then have a look at the output of the end
step for warnings (try searching the file name of one the files that should have been analyzed, and for "C#")/d:sonar.verbose=true
to the beginning step was tested and went through the analysis, these are the key points observation from the outputDEBUG: Sensors : SonarCSS Metrics -> SonarCSS Rules -> JaCoCo XML Report Importer -> C# Properties -> JavaXmlSensor -> XML Sensor.
This starts the CSS Analysis, by default, it is using node, -v, v8.12.0
. The following node processed is used for .cshtml files too.
For XML, the file was indexed during the beginning of Sonar scanner. This file is our own file of unrelated format analysis, not a part of sonarqube
Sensor JavaXmlSensor [java]
2 source files to be analyzed
'AnalysisFile.xml' generated metadata as test with charset 'UTF-8'
'wwwroot/XML/AnalysisFile_16-04-2019.xml' generated metadata as test with charset 'UTF-8'
Sensor JavaXmlSensor [java] (done) | time=1284ms
For C#
Sensor C# Properties [csharp]
Analyzer working directory '<ProjectDir>\.sonarqube\out\0\output-cs' contains 5 .pb file(s)
Found Roslyn issues report
Sensor C# Properties [csharp] (done) | time=15ms
Sensor C# [csharp]
No files to analyze. Skip Sensor.
Sensor C# [csharp] (done) | time=0ms
Java CPD Block Indexer' skipped because there is no related file in current project
Sensor Zero Coverage Sensor (done) | time=0ms
<filename>.cshtml generated metadata as test with charset 'UTF-8'
<filename>.cs generated metadata as test with charset 'UTF-8'
WARN:
are given before posting the analysisWARN: Missing blame information for the following files
WARN: * SonarQube.Analysis.xml
WARN: This may lead to missing/broken features in SonarQube
I am using Sonarqube 7.9 Community Edition
I am using the default plugin which gets downloaded with Sonarqube 7.9 Server - SonarC# - 7.15 (I am not sure if this is the same version getting installed as default in Sonarqube 7.9 Server
I tried the following steps for dotnetcore2.1, the C# and other files were analyzed
Also tried the following without Inhouse XML Analysis file if there was something breaking in analysis due to it.
The issue still persists
I wanted to test the environment if it is right with the same tools
Created new projects for dotnetcore2.1 and dotnetcore2.2
When running the sonarq analysis it ran perfectly analyzing all the files
@armourshield I see you've created duplicate topics in the community forum and on Stack Overflow, so I'm going to close this issue to avoid duplication of effort.
I will remove it from other forums, shall we continue the discussion here
The community forum is a better location: it is monitored by more people who might be able to answer, or which might be interested in the answer.
I am trying sonarqube on my aspnetcore2.2 project.
The project uses MSbuild version - 16.1.76.45076.
When I run the official dotnet-sonarscanner tool - version 4.6.2, only CSS code is getting analyzed and not the C#, Javascript and other codes being analyzed from the project.
I have tried the following,
Using Different MSBuilds:
I have tested with different MSBuild versions as there was a change in MSBuild from aspnetcore2.1 to aspnetcore2.2
Versions tried
Both returned with the same result of not analyzing any files other than CSS files.
Using Different Sonarscanner tools:
I also went ahead and checked with different sonarscanner tools
Sonarscanner tools used
All resulted in the same result of no file other than CSS files being analyzed
Verification of Project Settings in Sonarqube:
To check if the server-side is setup properly, I tested on different frameworks of aspnetcore
Tested frameworks
Only in aspnetcore2.2, I am facing this problem.
aspnetcore2.0, aspnetcore2.1 were analyzed for all the files C#, HTML, Javascript and CSS
These were also tested with different MSBuild versions and sonarscanner tools.
CLI Command tried
These are the CLI used for the replication of the problem
All the below commands didn't return an error.
Only the CSS files were getting analyzed for aspnetcore2.2 projects
The commands were tried in different combination as described above to replicate version problems
The expected result is
The actual result is