Queuing a build in PowerShell
I just read Aaron's post "Team Build Object Model - Queueing a Build" and I just had convert his code to PowerShell (for those of us that just hate waiting for code to compile!).
So, here is how to Queue a build in PowerShell (uses my Get-BuildServer script found here):
> $buildserver = Get-BuildServer "https://tfs:8080"
> $teamProject = "TeamProject"
> $buildDefinition = "Nightly"
> $definition = $buildserver.GetBuildDefinition($teamProject, $buildDefinition)
> $request = $definition.CreateBuildRequest()
> $buildserver.QueueBuild($request, "None")
As you can see the code is almost identical (minus the great comments that Aaron's code has). The benefit that I see to doing this in PowerShell is simply that you don't have to open VS, create a new project, write the code, compile it, open the bin folder, and then run the exe. Instead, you can simply open PS, type the code, and see the results.
Look for more PowerShell scripts coming soon like Queue-Build.ps1!
Comments
Anonymous
July 27, 2007
PingBack from http://www.ditii.com/2007/07/27/visual-studio-2008-beta-2-with-go-live-license/Anonymous
August 20, 2014
I can't this to work if I put this script in a tfrs build to queue multiple builds. Nothing happens and the builds do not get queued. Have you tried this before?