Free Support Forum -

Gantt bar styling does not apply on summary tasks and milestones (C# .NET)


Gantt bar styling applies on default tasks, but not on summaries nor milestones.

Code sample for a milestone :

var defaultView = _project.DefaultView as GanttChartView;
var chartView0 = _project.Views.ToList()[0] as GanttChartView;
var chartView1 = _project.Views.ToList()[1] as GanttChartView;

Aspose.Tasks.Task currentTask = _project.RootTask.Children.Add(task.Name);
currentTask.Set(Tsk.Start, new DateTime(2019, 10, 21, 08, 00, 00));
currentTask.Set(Tsk.Duration, _project.GetDuration(0, TimeUnitType.Day));

Color color = Color.Yellow;

GanttBarStyle style = new GanttBarStyle();
style.ShowFor = currentTask.Get(Tsk.Uid).ToString();

style.MiddleShape = GanttBarMiddleShape.RectangleBar;
style.MiddleFillPattern = GanttBarFillPattern.SolidFill;
style.MiddleShapeColor = color;

style.StartShapeType = GanttBarType.Solid;
style.StartShape = GanttBarEndShape.NoBarEndShape;
style.StartShapeColor = color;

style.EndShapeType = GanttBarType.Solid;
style.EndShape = GanttBarEndShape.NoBarEndShape;
style.EndShapeColor = color;


The same applies for summaries.

Thank you for your help


Can you please share complete working sample project along with generated result and sample code so that we may further investigate to help you out.


This code sample is basically all you need to reproduce the issue.
Please find attached the generated file : (23.3 KB)

Best regards


I have worked with source code shared by you and unable to observe issue. Can you please check attachment. Also please share source file and generated result comparison screenshot with us for further (23.9 KB)

Thank you for your help Adnan,
It appears that in the .mpp file you provided the milestone is not yellow, as it should be with the code sample I provided, this is the issue we are facing.


Can you please share your desired output or comparison screenshot for further investigation.

Please find attached a screenshot of the actual behavior and an image of the expected output : (4.8 KB)

Thank you for your help


I have created an issue with ID TASKSNET-3601 in our issue tracking system to further investigate and resolve the issue. This thread has been linked with the issue so that you may be notified once the issue will be addressed.

1 Like

Hi Adnan,
Any updates on this issue ?


I have verified from our issue tracking system and like to share that issue is tentatively going to get resolved in Aspose.Tasks for .NET 20.2 and we will share feedback with you once it will be fixed.