When I export the MPP file, I want to remove resource automatically calculate about StartDate and duration compute limited

When I exported more than 500 tasks, I found it very slow, which was intolerable,so I’m going to use a batch to generate the file:

IList taskList = XXXXX;–from DB
int iTotal = taskList.Count;
int iBatchSize = 20;
for (int i = 0; i < iTotal; i++){

Resource rsc2 = project.Resources.Add(“Res”);
rsc2.Set(Rsc.Name, epmowner);
rsc2.Set(Rsc.Type, ResourceType.Work);
// Assign the resource desired task
ResourceAssignment assn = project.ResourceAssignments.Add(task, rsc2);

if (iTotal > 100 && i > 19 && i % iBatchSize == 0)
{
project.Save(mspriFileDir + projectName + “.mpp”, SaveFileFormat.MPP);
project = new Project(mspriFileDir + projectName+".mpp");
project.CalculationMode = CalculationMode.Manual;
}
}
But when one task have multiple Resouce Names the export task StartDate and Durationis are not what I expected ,or example, under the same branch, the same person has two upper and lower level related tasks. The last task will not start if it doesn’t finish the next task, the duration it will be 0, which is actually exported from the database 3
I hope:
Task name | Duration | Start |. … …|Resource Names
task0 6 20171101 Tom
----task1 6 20171101
--------task1-1 6 20171101
----task2 3 20171103 Jack,Tom
not like this:
Task name | Duration | Start |. … …|Resource Names
task0 6 20171101 Tom
----task1 6 20171101
--------task1-1 6 20171101
----task2 0 20171101 Jack,Tom

@yiyibaba,

Thank you for writing to Aspose support team.

We are analyzing this issue and need further assistance to reproduce this issue at our end. Please provide the following for our testing:

  1. A console application which can be compiled and executed here. This code should be simple and able to re-produce the scenario. Please remove all the database calls and minimum data should be embedded in the code so that no external reference is missing while running the code.

  2. Template MPP file which is used to create this project

  3. Expected output MPP file created using Microsft project. It will help us to observe the output which you are expecting.

  4. Actual output MPP which is generated using the above mentioned sample code

Performance considerations If I set CalculationMode.Manual Task 2 export result the duration is 0 days

// POST: /MSProject/question
public string question(string projectName)
{
string curProjRootPath = System.Web.Hosting.HostingEnvironment.MapPath("~/");
string mspriFileDir = curProjRootPath + “msfiles\”;
// Read an existing project
Project project = new Project(mspriFileDir + “MPPFileTemp.mpp”);
project.CalculationMode = CalculationMode.Manual;

            // Set project start date
            project.Set(Prj.StartDate, new DateTime(2017, 11, 1, 8, 0, 0));

            // Add tasks and set task meta data
            Task task = project.RootTask.Children.Add("Task 0");
            task.Set(Tsk.Uid, 1001);
            task.Set(Tsk.OutlineLevel, 1);
            DateTime pstartdate = new DateTime(2017, 11, 1);
            task.Set(Tsk.Start, pstartdate);
            task.Set(Tsk.Duration, project.GetDuration(48, TimeUnitType.Hour));

            //task.Set(Tsk.DurationFormat, TimeUnitType.Day);
            //task.Set(Tsk.Duration, project.GetDuration(3));
            //task.Set(Tsk.IsMarked, true);
            //task.Set(Tsk.IgnoreWarnings, true);


            Resource rsc = project.Resources.Add("Tom");
            //rsc.Set(Rsc.Name, "Tom");

            // Assign the resource desired task
            ResourceAssignment assn = project.ResourceAssignments.Add(task, rsc);
            // ExEnd:SetGeneralResourceAssignmentProperties


            Task task2 = project.RootTask.Children.Add("Task 1");
            task2.Set(Tsk.Uid, 1002);
            task2.Set(Tsk.OutlineLevel, 2);
            DateTime pstartdate2 = new DateTime(2017, 11, 1);
            task2.Set(Tsk.Start, pstartdate2);
            task2.Set(Tsk.Duration, project.GetDuration(48, TimeUnitType.Hour));

            Task task3 = project.RootTask.Children.Add("Task 1-1");
            task3.Set(Tsk.Uid, 1003);
            task3.Set(Tsk.OutlineLevel, 3);
            DateTime pstartdate3 = new DateTime(2017, 11, 1);
            task3.Set(Tsk.Start, pstartdate3);
            task3.Set(Tsk.Duration, project.GetDuration(48, TimeUnitType.Hour));

            Task task4 = project.RootTask.Children.Add("Task 2");
            task4.Set(Tsk.Uid, 1004);
            task4.Set(Tsk.OutlineLevel, 2);
            DateTime pstartdate4 = new DateTime(2017, 11, 3);
            task4.Set(Tsk.Start, pstartdate4);
            task4.Set(Tsk.Duration, project.GetDuration(24, TimeUnitType.Hour));

            Resource rsc2 = project.Resources.Add("Jack");
            //rsc2.Set(Rsc.Name, "Jack");
            // Assign the resource desired task
            ResourceAssignment assn2 = project.ResourceAssignments.Add(task4, rsc2);

            Resource rsc3 = project.Resources.Add("Tom");
            //rsc3.Set(Rsc.Name, "Tom");
            // Assign the resource desired task
            ResourceAssignment assn3 = project.ResourceAssignments.Add(task4, rsc3);
            
            // ExEnd:SetGeneralResourceAssignmentProperties

            // Save project as MPP
            project.Save(mspriFileDir + projectName + ".mpp", SaveFileFormat.MPP);
            // ExEnd:WriteMetadataToMPP

        return "success";
    }<a class="attachment" href="/uploads/default/9076">1.png</a> (163.5 KB)

@yiyibaba,

Thank you for sending the sample code. It seems due to some issue, 1.png file is not uploaded. Also we need your template file “MPPFileTemp.mpp”. Please make it sure that you also provide us the expected output file created using Microsoft Project. We will work on this issue once the required files are provided.

Thank you for your patience and understanding in this regarding.

question.zip (213.6 KB)

@yiyibaba,

We are looking into this issue and will soon share our feedback with you here.

@yiyibaba,

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

	thanks very much

@yiyibaba,

You are welcome.