Updated MPP does not open in Microsoft project

I have the latest version of Tasks purchased last week.


Using a 2013 MPP, I open the project, change some dates in Aspose Tasks code, and update the MPP. The updated MPP is now unreadable by Microsoft project (it crashes).

If I save the MPP in 2007 format and repeat the same code it works fine.

Unfortunately for confidentiality reasons I cannot send you the MPP, but you may know if there are issues in this area.

Regards

Richard

Hi Richard,


Thanks for writing to Aspose.Tasks support team.

I have tried to re-produce the issue using sample Project 2013 file. A sample code is executed which creates tasks in blank 2013 MPP and save on disc. This saved file is opened again and date is changed. After processing the output file is opened using MSP 2013 and no issue is observed. Please give a try to the following code and let us know your feedback.
static void CreateTasks()
{
string path = @"";
string blank = path + “Blank2013.mpp”;
Project project = new Project(blank);
Console.WriteLine("Version = " + project.SaveVersion.ToString());

//Set Proejct Calendar
project.Calendar = Aspose.Tasks.Calendar.MakeStandardCalendar();

//Define a Summary task
Task summary = new Task(“Summary 1”);

// One day duration task (duration by default, if not set explicitly)
Task task1 = new Task(“Task 1”);
task1.Duration = new TimeSpan(8, 0, 0);

// Two days duration task
Task task2 = new Task(“Task 2”);
task2.Duration = new TimeSpan(16, 0, 0);

//Add the tasks to the Summary Task
summary.Children.Add(task1);
summary.Children.Add(task2);

// Define Root Task and Add summary to RootTask
project.RootTask = new Task(“Root task”);
project.RootTask.Children.Add(summary);


// Calculate Uids, Ids and update reference
//project.CalcCalendarUids();
project.CalcTaskUids();
project.CalcTaskIds();
project.UpdateReferences();

// Set first task start date, also set project start date
task1.Start = project.Calendar.GetNextWorkingDayStart(new DateTime(2013, 4, 23));
project.StartDate = project.RootTask.Start = task1.Start;
Task.Recalculate(project.RootTask);
project.Save(path + “Output2013.mpp”, Aspose.Tasks.Saving.SaveFileFormat.MPP);
}

static void ChangeDate()
{
string path = @"";
Project proj = new Project(path + “Output2013.mpp”);
Console.WriteLine("Version = " + proj.SaveVersion.ToString());
Task task1 = proj.GetTaskById(1);
task1.Start = task1.Start.AddDays(1);
Task.Recalculate(task1);

// Calculate Uids, Ids and update reference
proj.CalcCalendarUids();
proj.CalcTaskUids();
proj.CalcTaskIds();
proj.UpdateReferences();
proj.Save(path + “Output2013.mpp”, SaveFileFormat.MPP);
}
If it does not solve the issue, could you please share some sample file along with the code as it is must required to re-produce the issue and provide solution? Here at Aspose, only authorized people are allowed to access the user data. You may please mark this thread as private and share the required information.

Thanks for your cooperation and understanding in this regard.


Well I never expected ANY MPP 2013 would have a problem. Anyway by changing the first task to be not manually scheduled the MPP loads and saves fine now.

Hi Richard,


Its good to know that your problem is resolved. Please feel free to write us back if you have any additional query related to Aspose.Tasks.