My ASP WebForms Projects are not scanned by sonarqube

Hi,

all of my ASP WebForms Projects are not scanned by sonarqube. After the Scan of a Solution i can see that those Projects are missing in the Code-Section, and in the Project Information the Lines of Code are 0.

I am using sonarqube-8.4.1.35646.

I installed and scanned my project with the help from this tutorial:
https://docs.sonarqube.org/latest/setup/get-started-2-minutes/

In the Code Section i see that just a few of my projects in the solution are scanned
image

this is the solution:

At least the project UDIT.WKD.EKMv3.WebApp should get analyzed, but its missing. its a regular .net 4.5 ASP WebForms Application.

here is my output:

D:\Entwicklung\VisualStudio2010\Projects\UDIT.WKD.EKMv3>SonarScanner.MSBuild.exe end
SonarScanner for MSBuild 4.10
Using the .NET Framework version of the Scanner for MSBuild
Post-processing started.
Calling the SonarQube Scanner...
INFO: Scanner configuration file: D:\Programme\sonar-scanner-msbuild-4.10.0.19059-net46\sonar-scanner-4.4.0.2170\bin\..\conf\sonar-scanner.properties
INFO: Project root configuration file: D:\Entwicklung\VisualStudio2010\Projects\UDIT.WKD.EKMv3\.sonarqube\out\sonar-project.properties
INFO: SonarScanner 4.4.0.2170
INFO: Java 1.8.0_261 Oracle Corporation (32-bit)
INFO: Windows 10 10.0 x86
INFO: User cache: C:\Users\boris.feuerpeil.UDIT\.sonar\cache
INFO: Scanner configuration file: D:\Programme\sonar-scanner-msbuild-4.10.0.19059-net46\sonar-scanner-4.4.0.2170\bin\..\conf\sonar-scanner.properties
INFO: Project root configuration file: D:\Entwicklung\VisualStudio2010\Projects\UDIT.WKD.EKMv3\.sonarqube\out\sonar-project.properties
INFO: Analyzing on SonarQube server 8.4.1
INFO: Default locale: "de_DE", source code encoding: "windows-1252" (analysis is platform dependent)
WARN: SonarScanner will require Java 11 to run starting in SonarQube 8.x
INFO: Load global settings
INFO: Load global settings (done) | time=406ms
INFO: Server id: BF41A1F2-AXQP8eOSnrIOsLGUMmVf
INFO: User cache: C:\Users\boris.feuerpeil.UDIT\.sonar\cache
INFO: Load/download plugins
INFO: Load plugins index
INFO: Load plugins index (done) | time=383ms
INFO: Load/download plugins (done) | time=423ms
INFO: Process project properties
INFO: Process project properties (done) | time=15ms
INFO: Execute project builders
INFO: Execute project builders (done) | time=16ms
INFO: Project key: EKM
INFO: Base dir: D:\Entwicklung\VisualStudio2010\ClassLibrary
INFO: Working dir: D:\Entwicklung\VisualStudio2010\Projects\UDIT.WKD.EKMv3\.sonarqube\out\.sonar
INFO: Load project settings for component key: 'EKM'
INFO: Load project settings for component key: 'EKM' (done) | time=359ms
INFO: Load quality profiles
INFO: Load quality profiles (done) | time=416ms
INFO: Load active rules
INFO: Load active rules (done) | time=6237ms
INFO: Indexing files...
INFO: Project configuration:
INFO: Indexing files of module 'UDIT.WKD.General.Model'
INFO:   Base dir: D:\Entwicklung\VisualStudio2010\ClassLibrary\UDIT.WKD.General\UDIT.WKD.General.Model
INFO:   Source paths: CostCentre.cs, Account.cs, AddisonSupplierMapping.cs, Address...
INFO: Indexing files of module 'UDIT.WKD.General.DataAccess.Contracts'
INFO:   Base dir: D:\Entwicklung\VisualStudio2010\ClassLibrary\UDIT.WKD.General\UDIT.WKD.General.DataAccess.Contracts
INFO:   Source paths: Accounting/IAccountingWorkflowRepository.cs, Addison/IAddison...
INFO: Indexing files of module 'UDIT.Tools.ASP.WebForms'
INFO:   Base dir: D:\Entwicklung\VisualStudio2010\ClassLibrary\UDIT.Tools.ASP.WebForms
INFO:   Source paths: CollectionExtensions.cs, DataGridSorting/SortExpressionConver...
INFO: Indexing files of module 'EKM'
INFO:   Base dir: D:\Entwicklung\VisualStudio2010\ClassLibrary
INFO: 89 files indexed
INFO: Quality profile for cs: Sonar way
INFO: ------------- Run sensors on module UDIT.WKD.General.Model
INFO: Load metrics repository
INFO: Load metrics repository (done) | time=361ms
INFO: Sensor SonarCSS Rules [cssfamily]
INFO: No CSS, PHP, HTML or VueJS files are found in the project. CSS analysis is skipped.
INFO: Sensor SonarCSS Rules [cssfamily] (done) | time=0ms
INFO: Sensor JaCoCo XML Report Importer [jacoco]
INFO: 'sonar.coverage.jacoco.xmlReportPaths' is not defined. Using default locations: target/site/jacoco/jacoco.xml,target/site/jacoco-it/jacoco.xml,build/reports/jacoco/test/jacocoTestReport.xml
INFO: No report imported, no coverage information will be imported by JaCoCo XML Report Importer
INFO: Sensor JaCoCo XML Report Importer [jacoco] (done) | time=16ms
INFO: Sensor C# Properties [csharp]
WARN: Analyzer working directory does not exist: 'D:\Entwicklung\VisualStudio2010\Projects\UDIT.WKD.EKMv3\.sonarqube\out\1\output-cs'. Analyzer results won't be loaded from this directory.
INFO: Sensor C# Properties [csharp] (done) | time=0ms
INFO: Sensor JavaXmlSensor [java]
INFO: Sensor JavaXmlSensor [java] (done) | time=0ms
INFO: Sensor HTML [web]
INFO: Sensor HTML [web] (done) | time=7ms
INFO: ------------- Run sensors on module UDIT.Tools.ASP.WebForms
INFO: Sensor SonarCSS Rules [cssfamily]
INFO: No CSS, PHP, HTML or VueJS files are found in the project. CSS analysis is skipped.
INFO: Sensor SonarCSS Rules [cssfamily] (done) | time=0ms
INFO: Sensor JaCoCo XML Report Importer [jacoco]
INFO: 'sonar.coverage.jacoco.xmlReportPaths' is not defined. Using default locations: target/site/jacoco/jacoco.xml,target/site/jacoco-it/jacoco.xml,build/reports/jacoco/test/jacocoTestReport.xml
INFO: No report imported, no coverage information will be imported by JaCoCo XML Report Importer
INFO: Sensor JaCoCo XML Report Importer [jacoco] (done) | time=0ms
INFO: Sensor C# Properties [csharp]
WARN: Analyzer working directory does not exist: 'D:\Entwicklung\VisualStudio2010\Projects\UDIT.WKD.EKMv3\.sonarqube\out\0\output-cs'. Analyzer results won't be loaded from this directory.
INFO: Sensor C# Properties [csharp] (done) | time=0ms
INFO: Sensor JavaXmlSensor [java]
INFO: Sensor JavaXmlSensor [java] (done) | time=0ms
INFO: Sensor HTML [web]
INFO: Sensor HTML [web] (done) | time=16ms
INFO: ------------- Run sensors on module UDIT.WKD.General.DataAccess.Contracts
INFO: Sensor SonarCSS Rules [cssfamily]
INFO: No CSS, PHP, HTML or VueJS files are found in the project. CSS analysis is skipped.
INFO: Sensor SonarCSS Rules [cssfamily] (done) | time=0ms
INFO: Sensor JaCoCo XML Report Importer [jacoco]
INFO: 'sonar.coverage.jacoco.xmlReportPaths' is not defined. Using default locations: target/site/jacoco/jacoco.xml,target/site/jacoco-it/jacoco.xml,build/reports/jacoco/test/jacocoTestReport.xml
INFO: No report imported, no coverage information will be imported by JaCoCo XML Report Importer
INFO: Sensor JaCoCo XML Report Importer [jacoco] (done) | time=0ms
INFO: Sensor C# Properties [csharp]
WARN: Analyzer working directory does not exist: 'D:\Entwicklung\VisualStudio2010\Projects\UDIT.WKD.EKMv3\.sonarqube\out\2\output-cs'. Analyzer results won't be loaded from this directory.
INFO: Sensor C# Properties [csharp] (done) | time=0ms
INFO: Sensor JavaXmlSensor [java]
INFO: Sensor JavaXmlSensor [java] (done) | time=0ms
INFO: Sensor HTML [web]
INFO: Sensor HTML [web] (done) | time=0ms
INFO: ------------- Run sensors on module EKM
INFO: Sensor SonarCSS Rules [cssfamily]
INFO: No CSS, PHP, HTML or VueJS files are found in the project. CSS analysis is skipped.
INFO: Sensor SonarCSS Rules [cssfamily] (done) | time=0ms
INFO: Sensor JaCoCo XML Report Importer [jacoco]
INFO: 'sonar.coverage.jacoco.xmlReportPaths' is not defined. Using default locations: target/site/jacoco/jacoco.xml,target/site/jacoco-it/jacoco.xml,build/reports/jacoco/test/jacocoTestReport.xml
INFO: No report imported, no coverage information will be imported by JaCoCo XML Report Importer
INFO: Sensor JaCoCo XML Report Importer [jacoco] (done) | time=0ms
INFO: Sensor JavaXmlSensor [java]
INFO: Sensor JavaXmlSensor [java] (done) | time=0ms
INFO: Sensor C# [csharp]
INFO: Importing 3 Roslyn reports
INFO: Load project repositories
INFO: Load project repositories (done) | time=363ms
WARN: Rule CS0108 was not found in the SARIF report, assuming default severity
WARN: Rule CS0108 was not found in the SARIF report, assuming default severity
INFO: Sensor C# [csharp] (done) | time=459ms
INFO: ------------- Run sensors on project
INFO: Sensor Zero Coverage Sensor
INFO: Sensor Zero Coverage Sensor (done) | time=0ms
INFO: SCM Publisher SCM provider for this project is: svn
INFO: SCM Publisher 89 source files to be analyzed
INFO: 40/89 source files have been analyzed
INFO: SCM Publisher 89/89 source files have been analyzed (done) | time=17597ms
INFO: CPD Executor Calculating CPD for 0 files
INFO: CPD Executor CPD calculation finished (done) | time=0ms
INFO: Analysis report generated in 144ms, dir size=229 KB
INFO: Analysis report compressed in 217ms, zip size=88 KB
INFO: Analysis report uploaded in 361ms
INFO: ANALYSIS SUCCESSFUL, you can browse http://localhost:9000/dashboard?id=EKM
INFO: Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report
INFO: More about the report processing at http://localhost:9000/api/ce/task?id=AXQQqcIpBrKMYQMnRrJU
INFO: Analysis total time: 28.388 s
INFO: ------------------------------------------------------------------------
INFO: EXECUTION SUCCESS
INFO: ------------------------------------------------------------------------
INFO: Total time: 36.141s
INFO: Final Memory: 13M/32M
INFO: ------------------------------------------------------------------------
The SonarQube Scanner has finished
12:56:34.996  Post-processing succeeded.

D:\Entwicklung\VisualStudio2010\Projects\UDIT.WKD.EKMv3>

Any Help please?

hi @Boris_Feuerpeil and welcome to the community!

  • what is the version of Scanner for MSBuild you are using?
  • what is the version of MSBuild you are using?
  • what are the commands you are running to do the analysis?
  • are you running all commands from the same folder?
  • please give us the verbose output of the END step (please run SonarScanner.MSBuild.exe begin /k:"MyProject" /d:sonar.verbose=true as the BEGIN step, and please attach the output of END step)
  • please give the diag output of the build step ( msbuild /v:diag)

Hi Andrei,

  • what is the version of Scanner for MSBuild you are using?
    sonar-scanner-msbuild-4.10.0.19059-net46

  • what is the version of MSBuild you are using?
    14.0

  • what are the commands you are running to do the analysis?
    SonarScanner.MSBuild.exe begin /k:“EKM” /d:sonar.host.url=“http://localhost:9000
    “C:\Program Files (x86)\MSBuild\14.0\Bin\MsBuild.exe” /t:Rebuild /p:VisualStudioVersion=14.0
    SonarScanner.MSBuild.exe end

  • are you running all commands from the same folder?
    yes, from the solution Folder

  • please give us the verbose output of the END step (please run SonarScanner.MSBuild.exe begin /k:"MyProject" /d:sonar.verbose=true as the BEGIN step, and please attach the output of END step)
    See the Attachment output.zip

  • please give the diag output of the build step ( msbuild /v:diag )
    See the Attachment output.zip

Thank you for your help

OUTPUT.zip (366.8 KB)

You can see what files are marked as source in <PROJECT_GUID>.sonar.sources=\ in the END_OUTPUT logs. I don’t see any mention for the project you mention UDIT.WKD.EKMv3.WebApp in the END step.

I see in the logs a reference to VisualStudio2010. You need to use MSBuild.exe that comes with Visual Studio 2015 Update 3 (or Visual Studio 2017 any update) (see similar thread and also this solution from another thread).

You should also use the latest Scanner for MSBuild, it may fix issues.

UDIT.WKD.EKMv3.WebApp is a regular .net WebForms Project (VB in this case), See here:

image

The VisualStudio2010 reference you saw is missleading. Its just a Folder in the FileSystem. We use VS 2017. See here:

14.0 is the msbuild.exe from Visualstudio 2017 as far as i know. But i also tried msbuild 15.0, also doesnt work.

4.10 is the current Version of SonarScanner i use, and the newest Version i got from here:
https://docs.sonarqube.org/latest/analysis/scan/sonarscanner-for-msbuild/

Here are my outputs, when i use MSBUILD 15.0. See the Zipfile.

OUTPUT.zip (203.5 KB)

here the commands i executed:

SonarScanner.MSBuild.exe begin /k:“EKM” /d:sonar.verbose=true
“C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MsBuild.exe” /t:Rebuild /v:diag > c:\MSBUILD_OUTPUT.txt
SonarScanner.MSBuild.exe end > c:\MSBUILD_END_OUTPUT.txt

so, no solution for my problem?

hi @Boris_Feuerpeil

D:\Entwicklung\VisualStudio2010\Projects\UDIT.WKD.EKMv3\UDIT.WKD.EKMv3.WebApp\UDIT.WKD.EKMv3.WebApp.vbproj(2055,11): error MSB4226: Das importierte Projekt “C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\Microsoft\VisualStudio\v15.0\WebApplications\Microsoft.WebApplication.targets” wurde nicht gefunden. Es wurde versucht “WebApplications\Microsoft.WebApplication.targets” in den Ausweichsuchpfaden fr $(VSToolsPath) - “C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v15.0” zu finden. Diese Suchpfade werden in “C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exe.Config” definiert. Vergewissern Sie sich, dass der Pfad in der -Deklaration korrekt und die Datei auf einem Datentr„ger in einem der Suchpfade vorhanden ist.

Are these build errors normal in your build pipeline? I believe this is the project that is missing , right?