MS-Project XML import

Dear Aspose Support,



I have an issue regarding the import XML files to MS-Project. I create a planning and export it to XML-file by Aspose.Tasks. On import to MS-Project are some values on activity wrong. In attachment is a screenshot to this issue. Furthermore, I attached the XML-File with I run into the issue.



Please, can you check this issue.



Best regards.

Hi Andreas,


Thank you for contacting Aspose support team.

I have reviewed the image and the sample XML file. The XML file contains only one task which shows same date in notepad and MSProject. I could not re-produce the scenario using these sample files and need further assistance in this regard. Please provide a sample console application which can be used to create the XML file and observe the difference in source data and output XML file created by Aspose.Tasks. It will help us to analyze the issue and provide assistance as soon as possible.

Hallo Kashif,

Thank you for your quick reply.

The attached XML file is our output of Aspose.Task 7.3.0. The date in the XML output is the correct value set in our application by Aspose.Task (see the background window in the attached screenshot). On import this XML file into MS-Project the dates on the marked task (see screenshot) are different. The non marked task are correct.

The issue is not on create the XML by Aspose.Task but on import into MS-Project, or maybe any incorrect values in the XML file the interpret MS-Project different.

Is see no failure in our source code guide by the API documentation. To create a console application will not be constructive.

I hope I described our issue better.

Hi Andreas,

I tried to re-produce the scenario by exporting a task to XML file using Aspose.Tasks. This file is saved on disc and later imported it to MS Project by opening it in MS Project. No difference is observed during this operation in the source task data and XML file opened in MS Project.

Now for further investigation, we need your sample data which is exported to XML file along with the sample code used for this testing. We will run the code here and analyze the issue in our environment. After exporting data to XML, we will open it in MS Project and compare the results. Until and unless we don't get the code and sample data, it is not possible to re-produce the issue here and provide assistance.

Following is the sample code which I used for testing with Aspose.Tasks for .NET 8.0.0:


string dir = @"D:\";
Project proj = new Project();
Task tsk = proj.RootTask.Children.Add("Task 01");
tsk.Set(Tsk.Start, new DateTime(2015, 3, 5, 8, 0, 0));
tsk.Set(Tsk.Duration, proj.GetDuration(16, TimeUnitType.Hour));
proj.Save(dir + "SavedByTask.xml", SaveFileFormat.XML);

Hallo Kashif,



Thank you for your support on our issue.



I try to create sample project but get some trouble with the export. On import the XML into MS-Project shows me a message box “The start of a task is before the project starts”. To check this message I use the sample of the “Aspose.Tasks for .NET - Legacy API Documentation” (Aspose.Tasks 7.3.0) on page 68 and page 70.



I attached the sample project. Also a screenshot with the message box of MS-Project.



This issue is not expected. If I confirm the message box the tasks starts on 01/01/2000. Can you help me please on this issue so that I can create a sample project for the first issue.



I did a mistake at the first attachment. I attached you a wrong XML file. Now, I attached you the correct file (Vorlage Messe.xml) to reproduce the output of the first screenshot.

Hi Andreas,


Thank you for sharing the project and sample files.

I have executed the sample project and reviewed the resultant XML file. Following are my comments:

1. The year 2000 issue is because of not using the license. You may please visit here to see the limitations while not using the license.

2. The issue “The start of a task is before the project starts” is observed because when you create a project, its start date is set to current date. Now if any of the task contains date prior to it, this error will be displayed.

3. While we create a task and set a particular date, it is automatically changed to project start date due to default task constraint AsSoonAsPossible. You may please use appropriate constraint like StartNoEarlierThan to get the exact dates.

Following is a sample code which can be used to create the required output by following the above guidelines.

new License().SetLicense(@“E:\Aspose.Total.Net2015.lic”);

//create a project instance
Project prj = new Project();
prj.StartDate = new System.DateTime(2009, 8, 1);

//Define Tasks

Task tsk1 = new Task(“Task1”);
tsk1.Start = DateTime.Now;
tsk1.ConstraintType = ConstraintType.StartNoEarlierThan;
tsk1.ConstraintDate = tsk1.Start;


Task tsk2 = new Task(“Task2”);
tsk2.Start = DateTime.Now;
tsk2.ConstraintType = ConstraintType.StartNoEarlierThan;
tsk2.ConstraintDate = tsk2.Start;


//Add tsk1 and tsk2 to the rootTsk
prj.RootTask.Children.Add(tsk1);
prj.RootTask.Children.Add(tsk2);


//Add a task
Task tskADD = new Task(“Added”);
tskADD.ConstraintType = ConstraintType.StartNoEarlierThan;
tskADD.ConstraintDate = new System.DateTime(2009, 8, 1);

tskADD.Start = new System.DateTime(2009, 8, 1);
tskADD.Finish = new DateTime(2009, 8, 5);
prj.RootTask.Children.Add(tskADD);


//Perform recalculations
prj.CalcTaskIds();
prj.CalcTaskUids();


//Save the project as XML project file
prj.Save(@“D:\project6.xml”, Aspose.Tasks.Saving.SaveFileFormat.XML);


You can get a 30-day temporary license free of cost from step 4 here and use it for evaluating the product completely at your end. Temporary licenses are free of cost and you don’t have to pay for it. Please get yourself one and let us know if we can be of any additional help to you in this regard.

Thanks & Best Regards,

Muhammad Waqas


Hello Muhammad,



as requested, I have created a sample project. However, it was a little difficult to get the desired output which time has needed.



In the appendix you will find a project that generates an XML file that is changed the planning on import into MS Project. I marked the concerned tasks in the source code. Compare the defined start and end times.



In our productive application we determined the issue depends on a zero timespan for the ActualWork at the ResourceAssignment object. In the sample project you can reproduce this by comment out the line.



I hope you can work with this project.



Best regards

Hi Andreas,


Thank you for providing the detailed code sample.

Unfortunately, I get an exception when I try to execute your sample application and am unable to investigate the issue further. Could you please confirm if you have provided us with the correct sample code? Moreover, we have revamped the API with new Aspose.Tasks for .NET one and we recommend our users to use this new library as support for the old version will not be provided after this month.

Hallo Muhammad,



the exception occurs if I want to manipulate to root task. Now, I exclude the root task out of manipulation. Please, check the corrected project in the appendix.



As I understand the will be no fixes for Aspose.Tasks 7.X.X and you recommend us to change to Version Aspose.Tasks 8.X.X. Is this correct?



Best regards,

Hi Andreas,

I have gone through the code and following are the comments:

1. Working hours are set as 8:00 AM to 4:00 PM. However, tasks are started on 3:38 PM and finished on next day at 3:38 PM.
2. Tasks start and finish time span is 24 hours for one day task, where as time span should be 8 hours. For example Tasks start at “2015, 03, 05, 08, 38, 00” and finish at “2015, 03, 06, 08, 38, 00”. Across the date start/finish dates are quite confusing.
3. If you must want to follow the timings like task starts at 3:38:00 PM, then you may please adjust your working hours like start=3:38:00 PM and Finish Time = 11:38:00 PM. Also you may start one day task on same date according to the working hour start and finish time.
4. For testing purpose I set start time to 8:00 AM (as per calendar start time) to 4:00 PM for one day task and so on. After this if we run the program, the duration and start date issues are resolved.

Could you please test the attached code where times are set properly and output XML file is also attached?

Hallo Kashif,



as you recommend we change the end date of the task to 11:38 PM. But this had no effect and the result is the same. See the project changes in the appendix.



I’m not sure whether you recognize my issue correct. I would like to ask to get phone support with you. Is it possible to arrange an appointment?



Best regards

Hello Kashif,

This issue is very urgent, since it actually prevents the release of our software which should have been two weeks ago.

Please let us know if we can have a call with you so we can discuss the issue and possible solutions.

Please let us know when you have time and maybe a telephone number where we can reach you or a colleague of yours as soon as possible.

Hi Andreas,

I have modified the code such that the working hours are set to 15:38:00 and 23:38:00 as shown in the code at the end of this thread. There were few tasks in the sample data, which had start and end times
beyond the limit of working hours. Those times are also adjusted and code is executed. It can be seen in the output file and attached images, that the tasks you mentioned to check, are added fine and contain proper start/end time based on the links and constraints implemented on those tasks.

You may please go through the code, the output XML file and snapshots showing comparison of code and generated task in MSP. It can be seen that the tasks are created fine according to the sample data. If you still face any problem please send us the comparison images showing the issue. It should be noticed that when we link a task with some other task, and the predecessor task was finished before the day end, the linked task will start immediately on previous day. To avoid it, you may apply appropriate constraints on tasks.

Sample Code:


if (isWorkday)
{
weekDay.DayWorking = true;
Aspose.Tasks.WorkingTime workingTime = new Aspose.Tasks.WorkingTime();
workingTime.FromTime = new DateTime(minDateDay.Year, minDateDay.Month, minDateDay.Day, 15, 38, 00);
workingTime.ToTime = new DateTime(minDateDay.Year, minDateDay.Month, minDateDay.Day, 23, 38, 00);
weekDay.WorkingTimes.Add(workingTime);
defaultCalendar.Days.Add(weekDay);
}

Hello Kashif,



Your last reply is confusing me and I think, that it will not lead to success. I worked again on the sample project and reduced it to one task. The task is defined from 05/18/2015 15:38 to 06/01/2015 15:38 with a duration of 10 days. The MSP import change the duration to 11 days with ending at 06/02/2015 15:38. I reproduce the behaviour if the task start on 03/18/2015 15:38 and ends on 04/01/2015 15:38 (duration 10 days).



By analyse the XML output I find out that a additional without a duration (value) on 06/01/2015 ( 04/01/2015 in reproducing) is set. I attached you the modified project and a sample output.

Hi Andreas,


Following are the observations about the code:
1. As per the sample data, working hours should be adjusted.

private static Calendar CreateDefaultCalendar()
{


workingTime.FromTime = new DateTime(minDateDay.Year, minDateDay.Month, minDateDay.Day, 15, 38, 00);
workingTime.ToTime = new DateTime(minDateDay.Year, minDateDay.Month, minDateDay.Day, 23, 38, 00);

}


2. Project start and finish date should also be adjusted, when required.

3. When we set the task start, finish and duration, the finish date is ignored because it is automatically calculated using Start date and duration.

4. If you don’t set the duration, please set the task finish time according to working hours. For example in your code, I have changed the finish time to 23:38:00 hours rather than 15:38:00. Thus task should start at 15:38:00 and finish at 23:38:00 rather than 15:38:00 again.

I have made above changes in the sample code and now you may observe that duration becomes 10 days.

Please feel free to write us back if you have any other query in this regard.

Hello Kashif,





Thank you for your reply.





The calendar time are default times defined by users. We can not ensure if we modify the calendar that the planning is correct. So, we must use these defined calendars!





I want to explain the issue in detail:





1. In the calendar are working day defined from Monday to Friday 08:00 to 16:00.





2. We defined one task start at 05/18/2015 15:38 (Monday) and ends at 06/01/2015 15:38 (Monday). The duration is 10 days (TimeSpan(3,8,0,0) -> 3day , 8 Hours = 72 hours + 8 hours = 80 hours (); 10 working day * 8 hours = 80 hours equals () -> correct).





Starting first working day at 05/18/2015 15:38 and ends working time at 05/18/2015 16:00 are 22 minutes of duration. Continue on 05/19/2015 at 08:00 and ends 16:00 are working times 8 hours and adding 22 minutes from the day before. Adding next days until 06/01/2015.





Calculation:



05/18/2015 15:38 to 05/18/2015 16:00 (Monday) -> 22 minutes



05/19/2015 08:00 to 05/19/2015 16:00 (Tuesday) -> 8 hours



05/20/2015 08:00 to 05/20/2015 16:00 (Wednesday) -> 8 hours



05/21/2015 08:00 to 05/21/2015 16:00 (Thursday) -> 8 hours



05/22/2015 08:00 to 05/22/2015 16:00 (Friday) -> 8 hours



05/23/2015 Saturday (no working day)



05/24/2015 Sunday (no working day)



05/25/2015 08:00 to 05/25/2015 16:00 (Monday) -> 8 hours



05/26/2015 08:00 to 05/26/2015 16:00 (Tuesday) -> 8 hours



05/27/2015 08:00 to 05/27/2015 16:00 (Wednesday) -> 8 hours



05/28/2015 08:00 to 05/28/2015 16:00 (Thursday) -> 8 hours



05/29/2015 08:00 to 05/29/2015 16:00 (Friday) -> 8 hours



05/30/2015 Saturday (no working day)



05/31/2015 Sunday (no working day)



06/01/2015 08:00 to 06/01/2015 15:38 (Monday) -> 7 hours, 38 minutes



=> ______________

Duration 80 hours = 10 days -> correct





For the Aspose.Tasks XML output I got following (TimephasedData !!!):



05/18/2015 15:38 to 05/18/2015 16:00 (Monday) -> 22 minutes



05/19/2015 08:00 to 05/19/2015 16:00 (Tuesday) -> 8 hours



05/20/2015 08:00 to 05/20/2015 16:00 (Wednesday) -> 8 hours



05/21/2015 08:00 to 05/21/2015 16:00 (Thursday) -> 8 hours



05/22/2015 08:00 to 05/22/2015 16:00 (Friday) -> 8 hours



05/23/2015 Saturday (no working day)



05/24/2015 Sunday (no working day)



05/25/2015 08:00 to 05/25/2015 16:00

(Monday) -> 8 hours



05/26/2015 08:00 to 05/26/2015 16:00 (Tuesday) -> 8 hours



05/27/2015 08:00 to 05/27/2015 16:00 (Wednesday) -> 8 hours



05/28/2015 08:00 to 05/28/2015 16:00 (Thursday) -> 8 hours



05/29/2015 08:00 to 05/29/2015 16:00 (Friday) -> 8 hours



05/30/2015 Saturday (no working day)



05/31/2015 Sunday (no working day)



06/01/2015 Monday (no working day)



06/02/2015 08:00 to 06/02/2015 15:38 (Tuesday) -> 7 hours, 38 minutes



=> ______________

Duration 80 hours



BUT when I import into MSP it displays me a duration of 11 days. The question is: Why did Aspose.Tasks add a non working day on Monday 06/01/2015 ?





If I did not RessourceAssignments the task duration is correct but I have no resource calculation. No RessourceAssignments are not a solution for us.





Again, the question of technical phone support. I’m not sure you understand the issue correct and I want to explain you the issue in a remote session. Is this possible?





Best regards

Hi Andreas,

Thank you for sharing your feedback.

Upon further analysis, I was able to observe the issue. The issue seems to be with wrong timephase data generation by the API for the assignment. I have logged it as TASKS-33942 in our issue tracking system for further investigation and fix by our product team. I’d try to discuss the possibility of a hotfix version with our development team if the issue is fixed soon. In any case, I’ll share the updates here with you.

Hello Kashif,



I saw the hotfix on your website and checked our issue again. But, I can reproduce the same behaviour again for a task. I attached you a sample project (using Aspose.Task for .NET 7.4.1). Please, can you check the issue.



I created a task starts on 03/10/2015 08:38 and ends on 03/31/2015 08:38 with a duration of 15 days. In the XML output you will see there is a non working day on 03/31/2015 (it’s a Tuesday).



Best regards

Hi Andreas,

We are sorry for the inconvenience caused to you.

I was able to observe the difference in dates with the hotfix we provided earlier and the issue has been reopened now to be investigated thoroughly by our product team. We’ll notify you here once there is some information available in this regard.

In addition, could you elaborate from the output XML how the Tuesday is a non-working day? I was able to observe the date difference, but was not able to find Tuesday as non-working day.

Hello Kashif,

I mean, in the resource assignments (XML: Assignment) there is a additional day on 03/31/2015 (TimephaseData) with a duration value 0 (PT0H0M0S), but the day is a Tuesday an not marked as non working day.

Best regards