Task dates: unable to assigning dynamically


project.StartDate = new DateTime(2012, 07, 29, 8, 0, 0);

task1.Start = new DateTime(2012, 09, 30, 8, 0, 0);
task1.Duration = new TimeSpan(3 * 8, 0, 0);
Aspose.Tasks.Task summary = new Aspose.Tasks.Task(“Summary task”);
summary.Children.Add(task1);

project.RootTask.Children.Add(summary);
project.UpdateReferences();
project.CalcTaskIds();
project.CalcTaskUids();
task1.Deadline = task1.Start.AddDays(10);
task1.NotesText = “The first task.”;

task1.DurationFormat = TimeUnitType.MinuteEstimated;
task1.ConstraintType = ConstraintType.FinishNoLaterThan;
task1.ConstraintDate = task1.Deadline.AddDays(-1);

Aspose.Tasks.Task.Recalculate(task1);

// Create 10 new tasks
for (int i = 0; i < 10; i++)
{
Aspose.Tasks.Task task = new Aspose.Tasks.Task(string.Format(“Task{0}”, i + 2));
task.Start = task1.Start;
task.Duration = task1.Duration.Add(new TimeSpan(i + 1, 0, 0, 0));
task1.DurationFormat = TimeUnitType.Day;
task.Deadline = task1.Deadline.AddDays(i + 1);
task.Finish = project.Calendar.GetFinishDateByStartAndWork(task.Start, task.Duration);
summary.Children.Add(task);
}

I have taken the code from Aspose documentation link 
Writing Updated Task Data to MPP

Just i assigned different date to all tasks instead of 
project start date (please refer above code). 

After creating file and open in MS Project 2007 it’s showing Project start date only. 
For your information i am using latest version 5.2.0. 

Please provide solution or suggestions ASAP. 

Thanks in advance

Hi,


Thanks for writing to Aspose.Tasks support team.

I have analyzed the modified code and have observed the issue. It seems to be some regression issue and I am in contact with the development team to get the resolution for this. As soon as some feedback is received, I will inform you via this thread.

Please spare us little time and be patient for a while.

Hi,


I was able to reproduce this issue at my end using the latest version of Aspose.Tasks for .NET 5.2.0 and have logged it in our bug tracking system under issue id: TASKS-33315. Development team will look into it and once we have any information regarding the resolution of this issue, we’ll update you here via this thread.

If you have any other query/inquiry regarding Aspose.Tasks, please feel free to post to us. We’ll try to assist you further as soon as possible.

Hi,


I would like to share that if a task has to be started on specific day (task.Start), its ConstraintType should be MustStartOn. Similarly the task ConstraintDate should be equal to task Start date in order to have the appropriate dates in output file.

This change is required because MSP will use the constraint date for recalculation. If constraint dates are not set, MSP will consider any information it can like Project.StartDate, tasks.Early/late dates etc.

Please modify following segment of code in your sample and let us know your feedback.

// Create 10 new tasks
for (int i = 0; i < 10; i++)
{
Aspose.Tasks.Task task = new Aspose.Tasks.Task(string.Format(“Task{0}”, i + 2));
task.Start = task1.Start;

////////////////////////////////////////////////
//Add these two lines
task.ConstraintType = ConstraintType.MustStartOn;
task.ConstraintDate = task.Start;
////////////////////////////////////////////////

task.Duration = task1.Duration.Add(new TimeSpan(i + 1, 0, 0, 0));
task1.DurationFormat = TimeUnitType.Day;
task.Deadline = task1.Deadline.AddDays(i + 1);
task.Finish = project.Calendar.GetFinishDateByStartAndWork(task.Start, task.Duration);
summary.Children.Add(task);
}

The issues you have found earlier (filed as ) have been fixed in this Aspose.Words for JasperReports 18.3 update.