How to: Run SPCAF in a TFS 2015/VSTS TeamBuild

This article will guide you through how to run SPCAF in TFS 2015/VSTS.

Note: This functionality is only available in SPCAF Build License.

Note: At the moment in TFS 2017 you are only able to upload using the tfx command line tool. More details are located here.

SharePoint code analysis can also be executed during a TFS Team Build. This helps to ensure the correctness of the SharePoint code. During the Team Build, all found errors and warnings are listed in the build result. Additionally, the SPCAF reports can be generated and saved to the output directory.

The following described integration of SPCAF is possible for the following products:

  • Team Foundation Server 2015.
  • Visual Studio Team Services (VSTS).

To integrate SPCAF into the build process the following steps needs to be performed:

  1. Upload the SPCAF Build Task for TFS 2015 to TFS Server or VSTS.
  2. Add a SPCAF build step to your build definition.
  3. Configure the build step and run it.

Note: There is no installation of SPCAF on the TFS build servers necessary.

1. Uploading the SPCAF Build Task to TFS 2015 or VSTS

The SPCAF Build Task needs to be uploaded to your TFS 2015 or VSTS (via HTTP). To simplify this step SPCAF provides a separate application which uploads the build task automatically.

  1. Download a preconfigured package of "SPCAF Quality Gate for TFS 2015 and VSTS" from our Download Page.
  2. Extract the downloaded package to a temporary directory, e.g. c:\temp\SPCAFTemp.
  3. Run the SPCAF.TaskUploader.exe application.
  4. Enter the URL and the credentials of your TFS or VSTS server. If using VSTS server you must use Alternate authentication credentials set within your VSTS profile.
  5. Click "Start Upload".

The following screenshots show the result after a successful upload.

Add an SPCAF build step to your build definition

After successful upload, the SPCAF build task is ready to be integrated into a build definition.

  1. Create a new build definition or open an existing one.
  2. Click "Add..." to add an additional build step to the build definition.
  3. Select category "Build", select in this category the SPCAF build task and click "Add".
  4. Select the newly added SPCAF task and configure the build task to your needs.
  5. Save the build definition.

Configuration of build step

The following parameters can be configured for the build step.

Standard Settings

SPCAF_TFS2015_Table1_643x604

Reports

SPCAF_TFS2015_Table2_633x208

Advanced Options

SPCAF_TFS2015_Table3_646x953

Run a build and verify analysis results

After successful configuration, you can run a build and check the correct integration of SPCAF into the build process.

If SPCAF can find errors or warning they are displayed in the output of the build, see sample below:

To download the SPCAF analysis result reports go to section "Artifacts" in the build result. From there you can download a ZIP file which contains the created reports.

After download you have access to all generated reports:

Tags

Pre-Production | TFS | 2015 | VSTS | 2010/2013 | TeamBuild | Run | TN_U | AN_U | BQ_U