Using Aspose.Tasks 21.4.0.0
Original project created via Microsoft Project. It contains three automatically scheduled Tasks, each assigned to the same Resource. Opening the project in Aspose.Tasks, Set the CalculationMode to Manual. Loop through the Tasks and change each Task Duration from 3 to 8 Days. Perform a recalculation. Task 1 is reverting back to 3 days, Task 2 and Task 3 are correctly set to 8 Days and the overall schedule is adjusted.
If I remove the resource assignment from Task 1, the recalculation behaves as expected.
Any suggestions?
Project.png (32.1 KB)
Results_Bad.png (6.0 KB)
Results_Good.png (6.1 KB)
Code Sample:
string fileName = @"D:\_Projects\RSA\Test Files\Project_3B.mpp"; var project = new Project(fileName); project.CalculationMode = Aspose.Tasks.CalculationMode.Manual; var coll = new ChildTasksCollector(); TaskUtils.Apply(project.RootTask, coll, 0); var task1 = coll.Tasks[1]; var task2 = coll.Tasks[2]; var task3 = coll.Tasks[3]; Console.WriteLine(""); Console.WriteLine("Before Change"); Console.WriteLine("Task1 Start : {0} ", task1.Get(Tsk.Start)); Console.WriteLine("Task1 Finish : {0} ", task1.Get(Tsk.Finish)); Console.WriteLine("Task1 Duration : {0} ", task1.Get(Tsk.Duration)); Console.WriteLine("Task2 Start : {0} ", task2.Get(Tsk.Start)); Console.WriteLine("Task2 Finish : {0} ", task2.Get(Tsk.Finish)); Console.WriteLine("Task2 Duration : {0} ", task2.Get(Tsk.Duration)); Console.WriteLine("Task3 Start : {0} ", task3.Get(Tsk.Start)); Console.WriteLine("Task3 Finish : {0} ", task3.Get(Tsk.Finish)); Console.WriteLine("Task3 Duration : {0} ", task3.Get(Tsk.Duration)); task1.Set(Tsk.Duration, project.GetDuration(8, TimeUnitType.Day)); task2.Set(Tsk.Duration, project.GetDuration(8, TimeUnitType.Day)); task3.Set(Tsk.Duration, project.GetDuration(8, TimeUnitType.Day)); Console.WriteLine(""); Console.WriteLine("After Change"); Console.WriteLine("Task1 Start : {0} ", task1.Get(Tsk.Start)); Console.WriteLine("Task1 Finish : {0} ", task1.Get(Tsk.Finish)); Console.WriteLine("Task1 Duration : {0} ", task1.Get(Tsk.Duration)); Console.WriteLine("Task2 Start : {0} ", task2.Get(Tsk.Start)); Console.WriteLine("Task2 Finish : {0} ", task2.Get(Tsk.Finish)); Console.WriteLine("Task2 Duration : {0} ", task2.Get(Tsk.Duration)); Console.WriteLine("Task3 Start : {0} ", task3.Get(Tsk.Start)); Console.WriteLine("Task3 Finish : {0} ", task3.Get(Tsk.Finish)); Console.WriteLine("Task3 Duration : {0} ", task3.Get(Tsk.Duration)); project.Recalculate(); Console.WriteLine(""); Console.WriteLine("After Recalculate"); Console.WriteLine("Task1 Start : {0} ", task1.Get(Tsk.Start)); Console.WriteLine("Task1 Finish : {0} ", task1.Get(Tsk.Finish)); Console.WriteLine("Task1 Duration : {0} ", task1.Get(Tsk.Duration)); Console.WriteLine("Task2 Start : {0} ", task2.Get(Tsk.Start)); Console.WriteLine("Task2 Finish : {0} ", task2.Get(Tsk.Finish)); Console.WriteLine("Task2 Duration : {0} ", task2.Get(Tsk.Duration)); Console.WriteLine("Task3 Start : {0} ", task3.Get(Tsk.Start)); Console.WriteLine("Task3 Finish : {0} ", task3.Get(Tsk.Finish)); Console.WriteLine("Task3 Duration : {0} ", task3.Get(Tsk.Duration));