Search:     Advanced search

Surround SCM NAnt Integration

Article ID: 770  |  Last updated: 04 May, 2017

Surround SCM supports integration with NAnt.

This article includes information about integration requirements, supported Surround SCM actions, adding Surround SCM tasks to build files, and troubleshooting.


Supported Surround SCM actions

The following Surround SCM actions are supported: Get, Check Out, Check In, Freeze, Unfreeze, Branch, Label, and Batch. See to the NAnt Task Reference for task definitions and examples.

Adding Surround SCM tasks to build files

After the application project files are added to Surround SCM, you can add Surround SCM tasks to targets in the NAnt build file.

Note: You must provide the server connection information with Surround SCM tasks. If you received a server settings file for RSA key exchange from your Surround SCM administrator, you must specify the path to the XML file instead of the server address and port number

The attached file is an example build file for the Simple application, which was created using the Simple.cs file installed with NAnt in the nant/examples/Simple directory. The file includes Surround SCM tasks to get the latest version of project files, check in the files after the build, and create a snapshot branch to capture the build. Depending on your setup, you may need to add other tasks to the build. For example, you may add tasks to check out files depending on the server configuration or to freeze the branch before the build and unfreeze it after.

After the Surround SCM tasks are saved in the build file, enter the NAnt command at a command prompt to run the build.


Cannot recognize Surround SCM tasks

The contrib.nant package may not be installed correctly. Download the package and copy all the files to the NAnt directory.

Branch already exists

The snapshot branch name was not changed before the build. If using the Simple example, the snapshot branch name is hardcoded and must be changed before each build to create a snapshot branch with a unique name.

You may want to create a custom function to automatically generate a unique branch name based on the build timestamp. Keep in mind that the DateTime function returns a value that contains colons (:), which cannot be used in Surround SCM branch names. You may also want to store a version number in a separate file and create a function that reads the number, increments it for the branch name, and then updates the version number in the file for the next build.

Unable to check in files

The files are not checked out and Surround SCM does not allow check in without check out. A Surround SCM task to check out files is not used in the Simple example, so the example only works if connecting to a Surround SCM Server configured to allow check in of files without check out. Make sure the tasks added to your build file perform actions allowed in Surround SCM.

Files are read-only

The files were not made writable when retrieved from Surround SCM. Change the writable flag to true in the sscmget task to ensure retrieved files are writable.

A new build was not created after modifying the source file

A recursive get is also retrieving the application file in the bin repository and NAnt does not generate a new build because one already exists. Change the recursive flag to false in the sscmget task to ensure that only the files needed to compile the build are retrieved from Surround SCM.

Article ID: 770  |   Last updated: 04 May, 2017

Attached files
file SimpleNAntBuildFileExample.txt (2 kb)

Prev   Next
Surround SCM CruiseControl Integration     Visual Studio 2015 Integration Does Not Work with Surround SCM...