Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 5 Next »

The new structure of Team Foundation Build gives us a great opportunity to integrate better with your build and release processes from Visual Studio Team Services (VSTS) (formerly VSO) and on-premises Team Foundation Server (TFS) servers. We've created a public extension you can install into your VSTS instance or TFS 2015 server.  This extension makes the following tasks available to your Build and Release processes:

  • SonarQube Scanner for MSBuild - Begin Analysis
  • SonarQube Scanner for MSBuild - End Analysis
  • SonarQube Scanner CLI

The extension is open-sourced and available in GitHub SonarQube Scanner for MSBuild repository.

Installing the extension

If you're using Visual Studio Team Services (VSTS) or on-premises Team Foundation Server (TFS) 2015 Update 2 (or newer) you can simply install the extension from the marketplace and follow the instructions below.

  • Amaury Leve Add SonarQube Extension marketplace screenshot

After installing the extension, follow the below steps to get it running for your build.

Add a SonarQube Service Endpoint

  1. Open the Services page in your Visual Studio Team Services Control Panel
    Click the Settings cog icon in the top bar of the project screen and then click the Services menu.

  2. Click on New Service Endpoint and choose SonarQube.
  3. Specify a Connection Name, the Server URL of your SonarQube Server (including the port if required) and the Authentication Token to use.


  • Amaury Leve Add more details about the token. How to get it
    VAL: changed the Authentication Token text above to a link with the correct location...

Enable the SonarQube analysis in the Build Definition

The SonarQube Integration extension offers you two options for analyzing your project:

  • SonarQube Scanner for MSBuild
  • SonarQube Scanner CLI 

SonarQube Scanner for MSBuild

Use this analysis if you need to build your project with MSBuild (or Visual Studio).

  1. Open the Build Defintions page  in your Visual Studio Team Services Control Panel
    Click the Build & Release button on the top bar and then the Builds menu.
  2. Open and edit your Build Definition. Alternatively you can create a new Build Definition from scratch.
  3. Click the Add build step... button.
  4. Under the Build category, look and add both SonarQube for MSBuild - Begin Analysis and SonarQube for MSBuild - End Analysis build steps to your build definition.
    Amaury Leve - Add screenshot
  5. Drag and drop the SonarQube for MSBuild - Begin Analysis build step before the Visual Studio Build step (or the MSBuild step).
  6. Click the SonarQube for MSBuild - Begin Analysis build step to start the configuration.
    Amaury Leve - Add screenshot
  7. Select the SonarQube Endpoint you want to use. The list should display the available SonarQube Endpoints. If you haven't created one you can either click the Add or the Manage buttons.
    Amaury Leve - Add screenshot
  8. Fill in the Project Key, Project Name and Project Version you want to use for the analysis. 

    If the project does not exists into the SonarQube instance it will be created using the given Key, Name and Version and will use the default Quality Profile.

  9. Drag and drop the SonarQube for MSBuild - End Analysis build step after the Visual Studio Test step.
    Optional: To import code coverage into SonarQube, select the Visual Studio Test build step and tick Code Coverage Enabled.
  10. Click the Save button.

SonarQube Scanner CLI

Use this analysis for other type of projects.

  • No labels