Handling Critical and Effort-Driven Tasks

In Microsoft Project, different types of tasks define project structure and scheduling rules.

  • Tasks with no duration are considered milestones by default.
  • Critical tasks form the critical path, a sequence of tasks that determines how long the project will take.
  • Effort-driven tasks redistribute work when resources are added or removed, while keeping the total effort constant.

Understanding Critical and Effort-Driven Tasks

Aspose.Tasks for .NET allows developers to check and manage whether a task is critical or effort-driven programmatically.

The Tsk class provides the following fields:

Checking in Microsoft Project

In Microsoft Project, you can verify whether a task is critical or effort-driven by opening the Task Information dialog:

Check if a task is critical or effort-driven

Example: Retrieving Critical and Effort-Driven Tasks

The following code example demonstrates how to retrieve and check task properties for critical path and effort-driven configuration:

 1Project project = new Project("New Project.mpp");
 2
 3// Create a ChildTasksCollector instance
 4ChildTasksCollector collector = new ChildTasksCollector();
 5
 6// Collect all the tasks from RootTask using TaskUtils
 7TaskUtils.Apply(project.RootTask, collector, 0);
 8
 9// Parse through all the collected tasks
10foreach (Task task in collector.Tasks)
11{
12    string strED = task.Get(Tsk.IsEffortDriven) ? "EffortDriven" : "Non-EffortDriven";
13    string strCrit = task.Get(Tsk.IsCritical) ? "Critical" : "Non-Critical";
14    Console.WriteLine(task.Get(Tsk.Name) + " : " + strED);
15    Console.WriteLine(task.Get(Tsk.Name) + " : " + strCrit);
16}

Key Notes

FAQ

Q: Can a task be both critical and effort-driven?

Q: How does Microsoft Project calculate critical tasks?

Q: Do these properties work with both MPP and XML formats?

Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.