Hi
I use the following code, it's vb.net, but easily converted to C#
the following if may be omitted if the 'build' is delicate --> abort will
give unpredicted results
If p.Activity.IsBuilding Then
cm.AbortBuild(p.Name, "General Abort")
End If
Public Sub StopAllProjects(ByVal serverName As String)
Dim ServerUri As String = String.Format("tcp://{1}:21234/{0}",
ThoughtWorks.CruiseControl.Core.RemoteCruiseServer.URI, serverName)
Dim factory = New
ThoughtWorks.CruiseControl.Remote.RemoteCruiseManagerFactory()
Dim cm = factory.GetCruiseManager(ServerUri)
Dim projects = cm.GetCruiseServerSnapshot
For Each p In projects.ProjectStatuses
Console.WriteLine("Stopping project : {0}", p.Name)
cm.CancelPendingRequest(p.Name)
If p.Activity.IsBuilding Then
cm.AbortBuild(p.Name, "General Abort")
End If
cm.Stop(p.Name)
Next
End Sub
with kind regards
Ruben Willems
On 9 January 2012 16:39, Roman Müller <[email protected]> wrote:
> Hello
>
>
> I want to abort all builds for all projects programatically before
> starting the build for other projects. This is the code how i try it
> but that does not work.
>
> ProjectStatusResponse psr = manager.GetProjectStatus(new
> ServerRequest());
>
> foreach (ProjectStatus p in psr.Projects)
> {
> projectRequest = new ProjectRequest();
> projectRequest.ProjectName = p.Name;
> manager.AbortBuild(projectRequest);
> }
>
> Can someone help me please?
>
> Best regards and thanks in advance