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:
- Upload the SPCAF Build Task for TFS 2015 to TFS Server or VSTS.
- Add a SPCAF build step to your build definition.
- 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.
- Download a preconfigured package of "SPCAF Quality Gate for TFS 2015 and VSTS" from our Download Page.
- Extract the downloaded package to a temporary directory, e.g. c:\temp\SPCAFTemp.
- Run the SPCAF.TaskUploader.exe application.
- 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.
- 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.
- Create a new build definition or open an existing one.
- Click "Add..." to add an additional build step to the build definition.
- Select category "Build", select in this category the SPCAF build task and click "Add".
- Select the newly added SPCAF task and configure the build task to your needs.
- Save the build definition.
Configuration of build step
The following parameters can be configured for the build step.
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:
Pre-Production | TFS | 2015 | VSTS | 2010/2013 | TeamBuild | Run | TN_U | AN_U | BQ_U