Share via


How to: Configure a Scheduled Build (Command Line)

Recurring or scheduled build services are not included in the Team Foundation user interface in Team Foundation Server; however, the functionality can be accessed through the Team Foundation command-line command TFSBuild start and the Windows Task Scheduler service.

Required Permissions

To perform this procedure, you must have the Team Foundation Server Start a build permission set to Allow. For more information, see Team Foundation Server Permissions.

Configuring a Scheduled Build

To set up a recurring build, specify a Team Foundation Build build type for the TFSBuild start command as explained in the following procedure. For more information about build types, see Working with Build Types in Team Foundation Build. Before you run the TFSBuild start command, you must have the following information:

  • The name of the team project that contains the solution you want to build.

  • The name of the Team Foundation Build build type.

  • The URL of the Team Foundation server.

The following information is optional and if you do not provide values, the default values for the build type are used:

  • The name of the computer where the solutions are built.

  • The directory where the build process is occurring.

For more information, see Start Command (Team Foundation Build).

To create a batch file to run a scheduled build

  1. Create a batch file for the Windows Task Scheduler service. In Windows, click Start, click All Programs, click Accessories, and then click Notepad.

  2. In Notepad, type the TFSBuild start command together with the appropriate parameters specified in Start Command (Team Foundation Build), for example:

    c:\TFSBuild start https://server01 :8080 AdventureWorks Nightlies **/m:**Machine1 **/d:**BuildDirectory

    For more information, see How to: Start a Build from the Command Line.

    Note

    When you select a build directory, make sure that there is sufficient space to build. All folders under the workspace will be synchronized to this folder on the build computer when the build starts. The built binaries are temporarily stored here until copied to the drop location. Insufficient space causes the build to end.

  3. In Notepad, click Save on the File menu.

  4. In the Save As dialog box, locate the directory where you want to save the batch file and save the file.

    Security noteSecurity Note

    Use a secure share location with appropriate permissions when saving the file to prevent the file from being tampered with by unauthorized users.

  5. From Control Panel, click Scheduled Tasks, and then double-click Add Scheduled Tasks.

  6. In the Scheduled Task Wizard, click Next and then locate and open the batch file that you saved in step four.

  7. Optionally, type a name for the task or leave the default value.

  8. Under Perform this task, click Daily to select the desired frequency for running the batch file, and then click Next.

  9. Under Start time, enter the time of day to run the nightly build. For example, you might select 1:30 AM.

  10. Under Perform this task, select Every Day.

  11. Under Start Date, click a date, and then click Next.

  12. Enter the credentials for the owner of the task. Under Enter the user name, enter the appropriate name, enter password information, and then click Next.

    For example, you might type DOMAIN1\user1 as the user name.

  13. Click Next to complete scheduling the nightly build task.

To View Existing Scheduled Tasks in Windows

You can view and modify all the scheduled tasks in Windows by opening Scheduled Tasks in Control Panel. For more information, see Scheduled Tasks in Windows Help and Support.

See Also

Other Resources

Running Builds in Team Foundation Build