Analyzing. NET core application with SonarQube Scanner for MSBuild

Source: Internet
Author: User

Sonarqube is an open platform for managing code quality, omitting the installation process and below describes how to use Sonarqube to scan C # code.

Prerequisite: Download Sonarqube Scanner for MSBuild. Https://docs.sonarqube.org/display/SCAN/Analyzing+with+SonarQube+Scanner+for+MSBuild.

Because you are scanning a. NET core project, download the. NET core version and unzip it to a folder:

Modify SonarQube.Analysis.xml, modify sonar's service address, and login username and password

Open the cmd window and go to the source directory by command, run Sonnar Sacnner, altogether three steps:

1.dotnet <path to sonarscanner.msbuild.dll> begin

Parameter description:

/key (abbreviated K): Projectkey is the unique code for the project, and a project needs to have a separate projectkey

/name (abbreviated N): ProjectName is the name of the project

/version (abbreviated V): Projectversion is the version of the project

The complete command is as follows:

Dotnet "D:\sonar_dotnetcore\SonarScanner.MSBuild.dll" begin/k: "Netcoresonardemo"/name: "Netcoresonardemo"/version : "1.0"

Pre-processing succeeded The first step is successful, this will generate a. sonarqube folder in the project root directory,

2.dotnet Build

3.dotnet <path to sonarscanner.msbuild.dll> end

Error Pull! The reason is that we need to add a project GUID to the item, open the project, edit the Csproj,

Execute dotnet build,dotnet <path to sonarscanner.msbuild.dll> end, upload the analysis results to sonar successfully

At this point, the simple sonar analysis. NET core code is complete and the next step is to consider integrating Gitlab CI

Analyzing. NET core application with SonarQube Scanner for MSBuild

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.