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