NAnt SDK Documentation - v0.92 |

# Project.TopologicalTargetSort Method

Topologically sorts a set of targets.

[Visual Basic]
Public Function TopologicalTargetSort( _
ByVal root As String, _
ByVal targets As TargetCollection _
) As TargetCollection
[C#]
public TargetCollection TopologicalTargetSort(
string root,
TargetCollection targets
);

#### Parameters

root
  The name of the root target. The sort is created in such a way that the sequence of targets up to the root target is the minimum possible such sequence. Must not be a null reference (Nothing in Visual Basic).
targets
  A collection of Target instances.

#### Return Value

A collection of Target instances in sorted order.

#### Exceptions

Exception Type | Condition
--- | ---
BuildException | There is a cyclic dependecy among the targets, or a named target does not exist.

#### See Also

Project Class | NAnt.Core Namespace