Adding Resource to a Task changes the Task start/finish date

Is there a way to turn off recalculation of Task’s date when adding a Resource to the Task?

I’ve already set:

project.CalculationMode = CalculationMode.Manual

and I set the Task dates to be manual.

code snippet:

            eventTask = project.RootTask.Children.Add(title)
            ' make Task Manual, otherwise MS Project will recalculates dates.
            eventTask.Set(Tsk.IsManual, True)
            eventTask.Set(Tsk.IsEffortDriven, False)
            eventTask.Set(Tsk.Id, 1)
            eventTask.Set(Tsk.Name, title)
            eventTask.Set(Tsk.ManualStart, startDate)
            eventTask.Set(Tsk.NotesText, myCol.Description)
            eventTask.Set(Tsk.DurationFormat, TimeUnitType.Day)

            If (endDate >= startDate) Then
                eventTask.Set(Tsk.ManualDuration, eventTask.Get(Tsk.Duration).Add(GetDurationDays(startDate, endDate)))
                eventTask.Set(Tsk.ManualFinish, endDate)
            Else
                eventTask.Set(Tsk.ManualDuration, eventTask.Get(Tsk.Duration).Add(0))
            End If

Thanks for the help!
Cole

Hi,

Thank you for contacting Aspose support team.

I have tested the scenario by creating a task and adding a resource. However no issue is observed where task date is changed. Could you please give a try to the following sample code and let us know the feedback?

Dim proj As New Project()
proj.CalculationMode = CalculationMode.Manual
proj.[Set](Prj.StartDate, New DateTime(2016, 5, 16, 8, 0, 0))
Dim eventTask As Task = proj.RootTask.Children.Add("Task 1")
eventTask.[Set](Tsk.IsManual, True)
eventTask.[Set](Tsk.IsEffortDriven, False)
eventTask.[Set](Tsk.ManualStart, New DateTime(2016, 5, 16, 8, 0, 0))
eventTask.[Set](Tsk.NotesText, "These are notes text")
eventTask.[Set](Tsk.DurationFormat, TimeUnitType.Day)
eventTask.[Set](Tsk.ManualFinish, New DateTime(2016, 5, 16, 17, 0, 0))
eventTask.[Set](Tsk.ManualDuration, proj.GetDuration(1))
Dim person1 As Resource = proj.Resources.Add("Person 1")
Dim assn1 As ResourceAssignment = proj.ResourceAssignments.Add(eventTask, person1)
proj.Save("output.xml", SaveFileFormat.XML)

Set the Task start/finish to span more than one day and then add resource to the task. The Task dates changes. I want the Task’s Date NOT to change when I add a resource to that tasks.

        Dim proj As New Project(_projectTemplate)

        proj.CalculationMode = CalculationMode.Manual

        proj.[Set](Prj.StartDate, New DateTime(2016, 5, 18, 8, 0, 0))

        Dim eventTask As Task = proj.RootTask.Children.Add("Task 1")



        eventTask.[Set](Tsk.IsManual, True)

        eventTask.[Set](Tsk.IsEffortDriven, False)

        eventTask.[Set](Tsk.ManualStart, New DateTime(2016, 5, 20, 8, 0, 0))

        eventTask.[Set](Tsk.NotesText, "These are notes text")

        eventTask.[Set](Tsk.DurationFormat, TimeUnitType.Day)

        eventTask.[Set](Tsk.ManualFinish, New DateTime(2016, 5, 22, 17, 0, 0))

        eventTask.[Set](Tsk.ManualDuration, proj.GetDuration(1))



            Dim person1 As Resource = proj.Resources.Add("Person 1")

            Dim assn1 As ResourceAssignment = proj.ResourceAssignments.Add(eventTask, person1)


        Dim mppSaveOptions As New MPPSaveOptions()
        mppSaveOptions.WriteViewData = True

        ' Save as MS Project file
        proj.Save(resultFile, mppSaveOptions)

Hi,


I have checked your sample code without any change and generated the output MPP file.This MPP file is opened in MSP 2010 and compared with the source code. It is observed that there is no difference in the task start/finish date in the code and output file. Could you please explain where the date is changing for our reference? It will be helpful for us to observe problem and provide assistance as soon as possible.

Hi,

I’m using MS Project 2013 and Aspose.Tasks version 9.3.

Hi,


Thank you for assisting us to re-produce issue and we have observed the difference while opening output MPP file in MSP 2010 and MSP 2013. It is logged under Id: TASKS-34605 for further investigation by the product team. You will be automatically notified once any update is received in this regard.


Hi,

We need a status ASAP for task:TASKS-34605. Is there any workaround that can be done?

Thanks,
Cole Ruiz

Hi,


We are sorry but there is no ETA available at present for resolution of this issue. We have requested about this information from our Product team and will update you here once there is some information available in this regard.

Hi,

We have investigated the issue thoroughly and observed that MSP 2010 and MSP 2013 use different logic for task start/finish date calculation. Looks like MSP 2013 primarily considers all resource assignment in the calculation. You may please set Asn.Start and Asn.Finish date explicitly and share the feedback.

Dim proj As New Project(“Blank2010.mpp”)
proj.CalculationMode = CalculationMode.Manual
proj.[Set](Prj.StartDate, New DateTime(2016, 5, 18, 8, 0, 0))
Dim eventTask As Task = proj.RootTask.Children.Add("Task 1")
eventTask.[Set](Tsk.IsManual, True)
eventTask.[Set](Tsk.IsEffortDriven, False)
eventTask.[Set](Tsk.ManualStart, New DateTime(2016, 5, 20, 8, 0, 0))
eventTask.[Set](Tsk.NotesText, "These are notes text")
eventTask.[Set](Tsk.DurationFormat, TimeUnitType.Day)
eventTask.[Set](Tsk.ManualFinish, New DateTime(2016, 5, 22, 17, 0, 0))
eventTask.[Set](Tsk.ManualDuration, proj.GetDuration(1))
Dim person1 As Resource = proj.Resources.Add("Person 1")
Dim assn1 As ResourceAssignment = proj.ResourceAssignments.Add(eventTask, person1)
assn1.[Set](Asn.Start, New DateTime(2016, 5, 20, 8, 0, 0))
assn1.[Set](Asn.Finish, New DateTime(2016, 5, 22, 17, 0, 0))
Dim mppSaveOptions As New MPPSaveOptions()
mppSaveOptions.WriteViewData = True
'Save as MS Project file
proj.Save("CodeOutput.mpp", mppSaveOptions)