Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Updated instructions for VS code coverage - setting sonar.cs.vscoveragexml.reportsPaths is not required

...

  1. In your build definition, add:
    • At least Prepare Analysis Configuration task and Run Code Analysis task
    • Optionally Publish Quality Gate Result task
  2. Reorder the tasks to respect the following order:
    • Prepare Analysis Configuration task before any MSBuild or Visual Studio Build task.
    • Run Code Analysis task after the Visual Studio Test task.
    • Publish Quality Gate Result task after the Run Code Analysis task



  3. Click on the Prepare Analysis Configuration build step to configure it:
    1. The SonarQube Server section allows you to define the endpoint (i.e. SonarQube Server instance) to use.
      You can:
      • select an existing endpoint from the drop down list
      • add a new endpoint
      • manage existing endpoints

    2. Keep Integrate with MSBuild checked and specify at least the project key

      • Project Key - the unique project key in SonarQube

      • Project Name - the name of the project in SonarQube

      • Project Version - the version of the project in SonarQube

      In the Additional Properties text area, if you have test and want coverage report, add the following property: 
      sonar.cs.vscoveragexml.reportsPaths=**/*.coveragexml

  4. Click the Visual Studio Test task and check the Code Coverage Enabled checkbox to process the code coverage and have it imported into SonarQube. (Optional but recommended)

...