

How to: Run SPCAF in a TFS 2015/VSTS TeamBuild |
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 Downloads page. (https://www.spcaf.com/downloads/)
- 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
- Click "Start Upload".
The following screenshots shows the result after successful upload.

Add a 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.
Standard Settings
Argument | Description | Sample Value |
---|---|---|
Input directory | Required String. Relative or absolute path to the folder with the analyzable files (e.g. to the drop location). | artifacts\drop\bin |
Output directory | Optional String. Relative or absolute path to the folder where the result reports should be written to. Relative path is appended to the drop location. | artifacts\drop\SPCAFReports |
SPCAF License Key | Optional String. Relative or absolute path to the license key file (.lic). If empty only summary reports are created. Relative path is appended to the sources directory. | \SPCAF\License.lic |
SPCAF Settings File | Optional String. Relative or absolute path in source directory to the settings file. Relative path is appended to the sources directory.. | RS02_MinimumRecommendedRules |
Reports
Argument | Description | Sample Value |
---|---|---|
HTML | If checked a HTML report is created as result of the analysis. | |
DOCX | If checked a MS Word (.docx) report is created as result of the analysis. | |
If checked a Adobe PDF report is created as result of the analysis. | ||
CSV | If checked a CSV report is created as result of the analysis (can be opened in MS Excel). | |
XML | If checked a XML report is created as result of the analysis. | |
Dependency Diagram | If checked a Visual Studio DGML Diagram is created as result of the analysis. |
Advanced Options
Argument | Description | Sample Value |
---|---|---|
Log File | Relative or absolute path in source directory to the log file. | //fileshare/spcaf.log |
Output filename | Name of the output files. The name is used as a prefix for all generated reports. | spcafresult.html |
Verbosity | Level for verbosity to limit the detail level for log messages. Valid values are: quiet, minimal, normal, Default. | normal |
Temp Folder | Relative or absolute path in source directory to the temp folder. | //fileshare/tmp |
Skip Project Creation | If TRUE no project (.spcaf) file is created as output of the analysis. | |
Timeout | Optional seconds after the analysis should be cancelled automatically. | 60000 |
Filters | Optional list of extensions to filter the input files, e.g. '*.wsp;*.app'. | *.wsp;*.app;*.dll |
Recurse | If TRUE input directory are recursively scanned for analyzable files, if FALSE only the given root will be scanned. | |
Treat Errors as Warnings | If TRUE identified errors are reported as warnings. | |
Custom Rules Folder | Optional path to custom SPCAF rule assemblies. | //fileshare/customrules |
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:
