What is the best process for recalculating a Task Cost value?
I have sample project with two tasks, each associated with a Resource. If I programmatically change the Task durations, the cost is not being recalculated as I would have expected. It appears that the Cost and other resource related fields on the task are only updated if the Project is in CalculationMode = Auto at the time the change is made to the task.
We are working with large projects and for performance reasons, we are making changes to the project while it’s in Manual calculation mode.
Project OriginalProject = new Project(@"C:\SingleTask.mpp") {
};
var collector = new ChildTasksCollector();
TaskUtils.Apply(OriginalProject.RootTask, collector, 0);
OriginalProject.CalculationMode = CalculationMode.Manual;
foreach (var tsk in collector.Tasks) {
if (tsk.Get(Tsk.Uid) == 6) {
tsk.Set(Tsk.Duration, OriginalProject.GetDuration(10, tsk.Get(Tsk.DurationFormat)));
}
}
Is there anyway to get these fields to recalculate without needing to be CalculationMode Auto at the time the change is made?
SingleTask.zip (27.0 KB)