Hi,
Using the code below (code 01), can create the file correctly, resources containing the units correctly, but to reopen the file created and run only the code 02 units of resources are changed, I believe multiplied.
Could verify?
============================code 01============================
new Aspose.Tasks.License().SetLicense(@“c:\Aspose.Tasks.lic”);
Project project = new Project(@“Saved.mpp”);
Task tsk3 = project.RootTask.Children.First().Children.First().Children.First();
tsk3.Set(Tsk.Duration, tsk3.ParentProject.GetDuration(10, TimeUnitType.Day));
project.Save(@“Output.mpp”, Aspose.Tasks.Saving.SaveFileFormat.MPP);
Project project = new Project(@“Test_EmptyProject.mpp”);
project.CalculationMode = CalculationMode.Automatic;
project.Set(Prj.NewTasksAreManual, false);
Task tsk1 = project.RootTask.Children.Add(“Task 1”);
Task tsk2 = tsk1.Children.Add(“Task 2”);
project.Set(Prj.NewTasksAreManual, true);
Task tsk3 = tsk2.Children.Add(“Task 3”);
tsk3.Set(Tsk.IsManual, true);
tsk3.Set(Tsk.Start, new DateTime(2015, 2, 6, 9, 0, 0));
tsk3.Set(Tsk.Duration, tsk3.ParentProject.GetDuration(10, TimeUnitType.Day));
tsk3.Set(Tsk.ManualStart, tsk3.Get(Tsk.Start));
tsk3.Set(Tsk.ManualFinish, tsk3.Get(Tsk.Finish));
tsk3.Set(Tsk.ManualDuration, tsk3.Get(Tsk.Duration));
#region [Set Resources]
Resource rsc1 = project.Resources.Add(“Resource 1”);
rsc1.Set(Rsc.Type, ResourceType.Material);
Resource rsc2 = project.Resources.Add(“Resource 2”);
rsc2.Set(Rsc.Type, ResourceType.Material);
#endregion [Set Resources]
#region [Set Assignments]
project.ResourceAssignments.Add(tsk3, rsc1, 4);
project.ResourceAssignments.Add(tsk3, rsc2, 8);
#endregion [Set Assignments]
project.Recalculate();
project.Save(@“Output.mpp”, Aspose.Tasks.Saving.SaveFileFormat.MPP);
=======================================================
=======================code 02==========================
Project project = new Project(@“Saved.mpp”);
Task tsk3 = project.RootTask.Children.First().Children.First().Children.First();
tsk3.Set(Tsk.Duration, tsk3.ParentProject.GetDuration(10, TimeUnitType.Day));
project.Save(@“Saved.mpp”, Aspose.Tasks.Saving.SaveFileFormat.MPP);
=============================================================
Thanks.