Freigeben über


Managing builds through Command Line

Before Beta3, builds could be fired only through the UI. Now a command line alternative is available. The command line tool also provides options to stop and delete a build. The latter functionality is not available through the UI. The tool provides a command line help which explains the parameters required by the commands. This blog attempts to cover this new functionality.

Start

Starting a build requires START_BUILD permissions. Scenarios where you might want to use the command line to start a build are:-

  1. You want to integrate kicking off a build into your workflow; where build might be just one of the steps.
  2. You want builds to be kicked off at regular intervals of time. You could use the Windows scheduler and the command line interface to accomplish this.
  3. You might want to extend the functionality of the TFSBuild system provided. An example is writing a system for continuous integration.
  4. You just love working on the console:). A simple telnet to the office from home would enable you to do the needful.

D:Program FilesMicrosoft Visual Studio 8Common7IDE>TFSBuild.exe start https://btnhydbb03:8080 MyTestTeamProject MyTestTeamBuildType
Microsoft (R) TfsBuild Version 8.0.0.0
for Microsoft (R) Visual Studio 2005 Team System
Copyright (C) Microsoft Corporation 2004. All rights reserved.
Build number: MyTestTeamBuildType_20050926.2
Initializing build
Getting sources
Compiling sources
Compiling ConsoleApplication1.sln for Any CPU/Release
Compiling ConsoleApplication1.csproj
Compiling TestProject1.sln for Any CPU/Release
Compiling TestProject1.csproj
Compiling WindowsApplication1.sln for Any CPU/Release
Compiling WindowsApplication1.csproj
Getting changesets and updating work items
Running tests
Running tests for Any CPU/Release
Copying binaries to drop location
Copying log files to drop location
Successfully Completed
      Dump 1 Command line start console output

Compare this with the build report shown through the UI:-

  1. In the console output for the build; only the build steps are shown and the "Completed On" time for these steps is not shown. The idea is that when you are using the command line build; your main intent is to fire the build and nothing else.
  2. If you want to change the quality of the build or view the time taken for each build step you would have to go to the UI. For viewing other stuff such as change sets and work items; you could look up the Buildlog.txt in the drop share. 
     

Stop

A user starting the build or having ADMIN_BUILD permission can only stop the build.

  1. To stop a currently running build use this functionality.
  2. "Stopping" the build would kill the build process on the build machine and mark the status of the build as "Stopped".
  3. The event log on the AT has an entry per build stopped containing data about the user who stopped the build and the time when the build was stopped.
  4. There is no way to resume or unstop a stopped build.

D:Program FilesMicrosoft Visual Studio 8Common7IDE>tfsBuild stop https://btnhydbb03:8080 MyTestTeamProject MyTestTeamBuildType_20050926.3 /noprompt
Microsoft (R) TfsBuild Version 8.0.0.0
for Microsoft (R) Visual Studio 2005 Team System
Copyright (C) Microsoft Corporation 2004. All rights reserved.
Stopping MyTestTeamBuildType_20050926.3... Done
      Dump 2 Command line stop console output

Delete

ADMIN_BUILD permissions are required to delete a build. Deleting a build having tests enabled also requires PUBLISH_BUILD permisssions.

  1. Used for removing unneeded builds from the system
  2. Can delete multiple builds from the same Team Project on a single invocation.
  3. A delete on an ongoing build is not supported.
  4. Deleting a build entails deleting the entries for that build from the database and removing the binaries for that build from the drop location.
  5. Deleting the most recent build from a team project would cause the next build to have the same build number as the deleted build.
  6. Again an entry per deleted build is logged in the event log at the AT. 
     

D:Program FilesMicrosoft Visual Studio 8Common7IDE>tfsBuild delete https://btnhydbb03:8080 MyTestTeamProject MyTestTeamBuildType_20050926.1 MyTestTeamBuildType_20050926.3 /noprompt
Microsoft (R) TfsBuild Version 8.0.0.0
for Microsoft (R) Visual Studio 2005 Team System
Copyright (C) Microsoft Corporation 2004. All rights reserved.
Deleting MyTestTeamBuildType_20050926.1... Done
Deleting MyTestTeamBuildType_20050926.3... Failed
The path is not of a legal form.
      Dump 3 Command line delete console output

The failure to delete the last build is a known issue in Beta3 bits. This happens when a build that was stopped in the "Initializing Build" step is attempted to be deleted. The build has been deleted from the database; but not from the drop location. The workaround is to manually delete the folder from the drop share.

 

About Me

I have been at Microsoft for just over an year in the discipline of Test. Reading fiction is one of my hobbies that is still alive:-). I am onto "The Fountainhead" these days. Puzzleses excite me; and nothing is more attractive than what eludes me. Writing blogs is out of that elusive list now:-)