Created
September 26, 2023 21:38
-
-
Save manoj-choudhari-git/1c10a92bc9d44a244e62e83344e2192a to your computer and use it in GitHub Desktop.
SonarQube - To Trigger SonarQube Scan of a .NET Solution
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## -------------------------------------------------------------------------------- | |
## STEP 1 - INSTALL DOTNET-SONARSCANNER (One Time Setup) | |
## -------------------------------------------------------------------------------- | |
## To install dotnet sonarscanner tool globally (latest version) | |
## You can also specify the version you want to install using --version argument | |
dotnet tool install --global dotnet-sonarscanner | |
## -------------------------------------------------------------------------------- | |
## STEP 2 - BEGIN ANALYSIS | |
## -------------------------------------------------------------------------------- | |
## To Setup Hooks and Download Settings / Rules from SonarQube | |
## parameters : | |
## /k is for specifying the project key (required parameter | |
## /d is for specifying the authentication token | |
dotnet sonarscanner begin /k:"sample-project-key" /d:sonar.token="<token>" | |
## -------------------------------------------------------------------------------- | |
## STEP 3 - BUILD and TEST | |
## -------------------------------------------------------------------------------- | |
## To Build the Solution | |
dotnet build <path to .sln file> | |
## To Test the Solution | |
dotnet test <path to .sln file> | |
## -------------------------------------------------------------------------------- | |
## STEP 4 - END ANALYSIS | |
## -------------------------------------------------------------------------------- | |
## Uploads the analysis results and coverage files to SonarQube | |
## parameters : | |
## /d is for specifying the authentication token | |
dotnet sonarscanner end /d:sonar.token="<token>" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment