We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Creating a new mpp with Aspose Tasks is creating a standard calendar that is set to every day being non-working

Just noticed that when creating a new MPP file using

           // create a new project and try and set anything we can to Today to try and stop MSP showing a start date of 1984

            Aspose.Tasks.Project project = new Aspose.Tasks.Project();
            project.Set(Prj.StartDate, dtNow);
            project.Set(Prj.CurrentDate, dtNow);
            project.Set(Prj.StatusDate, dtNow);
            project.Set(Prj.NewTaskStartDate, TaskStartDateType.CurrentDate);
            project.Set(Prj.ScheduleFromStart, true);
            project.Set(Prj.FinishDate, dtNow.AddDays(1));

            project.CalculationMode = CalculationMode.Automatic;

Every day is set to non-working in the standard calendar. This is happening in 22.10.0 and 22.11.0 This did not used to happen with versions from over a year ago?

How do I restore Monday to Friday as working days in the standard calendar - or is this a bug.

The 24 hours and nightshift calendars still have working days

@JohnGlover

It’s a bug, we will fix it in the next release. A ticket with ID TASKSNET-10734 has been created to resolve the issue. This thread has been linked with the issue so that you may be notified once the issue will be fixed.

As a temporary workaround you can fill project.DefaultWeekWorkingDays collection:

            Aspose.Tasks.Project project = new Aspose.Tasks.Project();

            if (project.DefaultWeekWorkingDays.Count == 0)
            {
                var calendar = project.Calendars.ToList()[0];
                var weekDays = project.Calendar.WeekDays.ToList();

                // WeekDay for Sunday should be first item.
                if (weekDays[0].DayType == DayType.Monday)
                {
                    var sundayWeekDay = weekDays[6];
                    weekDays.RemoveAt(6);
                    weekDays.Insert(0, sundayWeekDay);
                }

                foreach (var weekDay in weekDays)
                {
                    project.DefaultWeekWorkingDays.Add(weekDay);
                }
            }

            project.Save("output.mpp", SaveFileFormat.Mpp);

The issues you have found earlier (filed as TASKSNET-10734) have been fixed in this update.
Download link