Percent Complete not updating when Save MPP file

I am trying to update the percent complete of some tasks but it is not working.

I have a MPP file, I open it and update the tasks.
When I save again to MPP, all tasks that I did the update is 0% complete and in some cases the MPP is save as blank file.
I am using 7.4.0 version

Below a piece of my code:

var prj = new Project(pathFile);
var t = prj.GetTaskByUid(uid);
t.SetPercentComplete(100);
Task.Recalculate(prj.RootTask);
prj.Save(pathOut, SaveFifleFormat.MPP);

Hi Delio,

Thank you for contacting Aspose Support team.

We have investigated this issue with the latest version of Aspose.Tasks for .NET 9.2.1 and no such issue is observed as you have shared. The following code sample properly sets the percent complete of the task to 100%. I have attached the input file here for your reference. Please try it with the latest version of the API and share your feedback with us.

Sample Code:

Project project = new Project(“Updated.mpp”);

Task task = project.RootTask.Children.GetByUid(1);

task.Set(Tsk.PercentComplete, 100);

project.Recalculate();

project.Save(“Updated-2.mpp”, SaveFileFormat.MPP);

Hi Kashif

I haved tested now with the version 8.7.0(last version of our subscription).
No I am able to update percent complete of child tasks, but parent tasks are not computed, it remains with 0%.
I did exactly the code that you sent.

How can I update parent tasks ?

Best

i Delio,

I have tested the following code to set the percentage of child task, and it is observed that parent task percent complete is automatically calculated. This code is tested using both Aspose.Tasks for .NET 8.7.0 and Aspose.Tasks for .NET 9.2.1. You may please test it using attached file and let us know the feedback.

Project proj = new Project(“Project1.mpp”);
Task t2 = proj.RootTask.Children.GetByUid(2);
t2.Set(Tsk.PercentComplete, 100);
proj.Save(“Updated921.mpp”,new MPPSaveOptions());

Hi Kashif,

I have tested your code but it is not works with my MPP file.
This strange situation. Look at attached file calculated.png. I did a console application that update percent complete and print on console the percent complete of the task and it parent.
On console it’s OK, parent was calculated.
But when I save and open this MPP on project, the value of parent is wrong (projectexport.png).

Can you help me ?

I am sending my MPP file attached.

Best

Hi Delio,

Thank you for providing supporting material.

This issue is reproduced here and logged under Id: TASKS-34508 for further investigation by the product team. You will be automatically notified once any update is available in this regard.