ResourceAssignment: Setting Start, Finish and Duration for task (C# .NET)

Hi,

any news?

@FabioMartins,

I have appended the information with thread and will share the feedback with you as soon as the issue will be addressed.

@FabioMartins hello, sorry for a delay for the answer.

If you remove the line with delay i.e.

        var assignment2 = project.ResourceAssignments.Add(tsk3, rsc2);
        assignment2.Set(Asn.Start, new DateTime(2018, 2, 1, 9, 0, 0));
        assignment2.Set(Asn.Finish, new DateTime(2018, 3, 23, 18, 0, 0));
        assignment2.Set(Asn.Work, project.GetDuration(296, TimeUnitType.Hour));
        assignment2.Set(Asn.Units, 296);
        //assignment2.Set(Asn.Delay, project.GetDuration(23, TimeUnitType.Day));

you get the finish date April 25, 2018 6:00 PM, because the start date is February 1, 2018 9:00 AM.

If you want to get Finish date equal to March 23, 2018 6:00 PM then set the start date to January 1, 2018 9:00 AM i.e.

        var assignment2 = project.ResourceAssignments.Add(tsk3, rsc2);
        assignment2.Set(Asn.Start, new DateTime(2018, 1, 1, 9, 0, 0));
        assignment2.Set(Asn.Finish, new DateTime(2018, 3, 23, 18, 0, 0));
        assignment2.Set(Asn.Work, project.GetDuration(296, TimeUnitType.Hour));
        assignment2.Set(Asn.Units, 296);
        //assignment2.Set(Asn.Delay, project.GetDuration(23, TimeUnitType.Day));