We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

How to make task start on the next day?

If a task has a predecessor and it ends at 5pm, the next task will still start at 5pm of the same day instead of the next day.

Hi Albert,

Thank you for writing to Aspose support team.

I have tried this scenario using following sample code but could not reproduce it. Could you please send us a simple console application (along with the template file if any) which can be compiled and executed here for our reference? It will help us to observe the problem and provide assistance accordingly.

Project proj = new Project();<o:p></o:p>

Task tsk1 = proj.RootTask.Children.Add("Task 1");

Task tsk2 = proj.RootTask.Children.Add("Task 2");

proj.TaskLinks.Add(tsk1, tsk2,TaskLinkType.FinishToStart);



This is the code of how I generated the mpp

Aspose.Tasks.Project project = new Aspose.Tasks.Project();
project.Set(Prj.StartDate, startDate);
project.Set(Prj.DefaultStartTime, startDate);
project.Set(Prj.StatusDate, startDate);

foreach (var task in projectPlan.Tasks)
var parent = projectPlan.Tasks.Take(projectPlan.Tasks.IndexOf(task)).LastOrDefault(t => t.TaskLevel < task.TaskLevel);
Task asposeTask = (parent != null) ? project.RootTask.Children.GetByUid(parent.ID).Children.Add(task.TaskName) : project.RootTask.Children.Add(task.TaskName);
asposeTask.Set(Tsk.IsManual, false);
asposeTask.Set(Tsk.Start, task.StartDate);
asposeTask.Set(Tsk.DurationFormat, TimeUnitType.Day);
asposeTask.Set(Tsk.Duration, project.GetDuration((double)task.Duration, TimeUnitType.Day));
asposeTask.Set(Tsk.IsMilestone, task.IsMilestone);
task.ID = asposeTask.Get(Tsk.Uid);

foreach (var task in projectPlan.Tasks.Where(x => x.Predecessors.Any()))
Task ptask = project.RootTask.Children.GetByUid(task.ID);
foreach (ProjectTaskPredecessor pred in task.Predecessors) {
Task ppredtask = project.RootTask.Children.GetByUid(projectPlan.Tasks.FirstOrDefault(pr => pr.ProjectTaskID == pred.ProjectTaskIDPre).ID);
TaskLinkType linkType = TaskLinkType.FinishToStart;
if (pred.TaskRelationshipID.Value == (int)TaskRelationshipValue.FF) linkType = TaskLinkType.FinishToFinish;
else if (pred.TaskRelationshipID.Value == (int)TaskRelationshipValue.SF) linkType = TaskLinkType.StartToFinish;
else if (pred.TaskRelationshipID.Value == (int)TaskRelationshipValue.SS) linkType = TaskLinkType.StartToStart;
TaskLink taskLink = project.TaskLinks.Add(ppredtask, ptask, linkType);

I’ve also attachd a resulting mpp. On the file, Task Closing (ID 13) has a predecessor Task Executing (ID 2), Task 2 ends at 5pm while Task 13 still starts at 5pm of the same day

Hi Albert,

We are sorry for getting back to you a little late. We have tried to compile and execute your sample code, but there are a number of compilation errors in this code with variables undefined as well. For this reason, we are not able to observe the issue you have mentioned. We would request you to please:

1. Share any input MPP/XML file
2. Provide us with sample runnable code that we can execute to generate to generate the output and investigate the issue as you have mentioned
3. If possible, please share a screenshot of the problem that you are facing for our clear reference


I’ve attached the data and code in the zip file. I’ve also attached the problem where the predecessor starts on the end of the day

Hi Albert,

I have tested the scenario using MSP 2010 where it is observed that if we set predecessor of a summary task, it does not take effect. However if we set predecessor of a leaf task, then it is updated properly.

Could you please review your code and set predecessor of a leaf task rather than any summary task? If there is still any issue for a leaf task, please share the feedback for our analysis along with the sample code and template file. It will help us to observe the issue and provide assistance accordingly.


Sorry, not familiar with the terms. What if the leaf task and how do I set the leaf?


In the attached image, there are two summary tasks and 4 child or non-summary tasks (which were referred as leaf tasks). If we set the predecessor of Summary task "Summary 2", it will not change anything as can be verified using Microsoft Project (I tested with MSP 2010).

1. For example if we set "Summary 2" predecessor to 2 (Task 1), it will not change "Summary 2" task start time to Dec 20, 2016 0800 etc.

2. However if we set the predecessor of non-summary task like "Task 3" predecessor as 2 (Task 1), it will change the start date/time of Task 3 immediately.

You may avoid setting the predecessor of summary task. Hope this clarifies the behavior. Please feel free to write us back if you have any other query in this regard.


The dates are still wrong. Ive set the predecessors to the leaf but the summary task stays as the start date of the project. Also when the leaf is a milestone, it still would start at the end of the same day

Hi Albert,

Thank you for providing the feedback. This issue is re-produced and logged under Id: TASKSNET-1744 for further investigation by the product team. You will be automatically notified once any update is received in this regard.


We have investigated the issue and following are the findings:

Beheviour of MSP in cases of Automatic and Manual planning is different. In case of Automatic planning the start and finish date of the succeeding task will be set to the finish date of the preceeding task. In case of manual task planning the start and finish date of the succeeding task will be set to the next working day start of the preceeding task. I prepared 2 samples, one with manual and one with automatic task planning (1744_ManualTasks.mpp and 1744_AutoTasks.mpp). As in your code sample tasks are set to Automatic planning ( asposeTask.Set(Tsk.IsManual, false); ). So when you try to set a preceeding task of 7 to 3, MSP set the start and finish date of task 7 to the finish date of task 3 i.e. 10/4/16 5:00 PM.

You can check this behavior by creating two MPP files in MSP such that one file contains automatic tasks only where as other mpp file contains manual tasks only. Then try to set the predecessor tasks and check the behavior. Sample MPP files are attached here for testing MSP behavior. Set predecessor task 2 against task 4 and 5 in both the MPP files by opening them in MSP and observe the difference for date calculation of task with 0 duration.

Similarly please notice that if some constraint is implemented for some task like “start no earlier than”, then setting the predecessor task may not change date if new calculated date is prior to the constraint date.

Please test you r scenarios again and share the feedback.
1744_AutoTasks.zip (25.2 KB)
1744_ManualTasks.zip (24.7 KB)