.NET project
Using YAML or the Azure Classic interface to create the Azure build pipeline for .Net projects.
Before you begin, read Azure Pipelines integration overview.
Once you have created your project in SonarQube Community Build, see Creating and configuring your project and Setting up project integration, you can add the SonarQube analysis to your Azure build pipeline.
To create your Azure build pipeline, you can use either YAML or the Azure Classic interface.
If you need to use a specific scanner version, see Using various features.
About the analysis parameter setup
Analysis parameters can be set at different levels: see Configuring the project analysis parameters. When creating your pipeline, you will have to enter the project key and you may also enter the project version and name. For more information about these task inputs, see the .NET mode in the SonarQube tasks for Azure Pipelines. You may define additional parameters in this task. In that case, these parameters have precedence over parameters defined at the project or global level.
Using YAML
Add the following SonarQube tasks to your YAML pipeline:
Before your build task, add a Prepare Analysis Configuration task.
After your build task, add a Run Code Analysis task.
After the Run Code Analysis task, add a Publish Quality Gate Result task.
See the YAML file example below. See also our YAML pipeline templates. For information about the SonarQube task inputs, see SonarQube tasks for Azure Pipelines.
Using the Classic interface
To add the analysis to your classic build pipeline:
In Azure DevOps Classic interface editor, create or update your build pipeline.
Add a Prepare Analysis Configuration task before your build task:
In SonarQube Service Endpoint, Adding SonarQube Community Build service connection to Azure Pipelines (SonarQube Community Build endpoint)
Under Choose a way to run the analysis, select Integrate with MSBuild.
In the Project key field, enter your project key.
Optionally, enter the project name and version.
Add a new Run Code Analysis task after your build task.
Add a new Publish quality gate Result on your build pipeline summary.
Ensure that the pipeline runs automatically for all the branches you want:
Under the Triggers tab of your pipeline, select Enable continuous integration and select all the branches for which you want SonarQube Community Build analysis to run automatically.
Save your pipeline.
.Net guides on the Sonar Community forum
We’ve prepared some guides on the Community Forum to help you with your .NET project.
.NET Configuration
.NET and Code coverage
Related pages
Using various features when adding the analysis to your pipeline
Overview of .NET analysis
Last updated
Was this helpful?