Extended Duration1-10 fields are always displayed in hours when added, regardless of the selected format (C# .NET)

public class Creator
private readonly Project asposeProject;

	public Creator(Project asposeProject)
		this.asposeProject = asposeProject;

	public void Run()
		ExtendedAttributeDefinition myTextAttributeDefinition = asposeProject.ExtendedAttributes.GetById((int)ExtendedAttributeTask.Text1);

		// If the Custom field doesn't exist in Project, create it
		if (myTextAttributeDefinition == null)
			myTextAttributeDefinition = ExtendedAttributeDefinition.CreateTaskDefinition(ExtendedAttributeTask.Text1, "My text field");

		// Generate Extended Attribute from definition
		ExtendedAttribute text1TaskAttribute = myTextAttributeDefinition.CreateExtendedAttribute();

		text1TaskAttribute.TextValue = "Text attribute value";

		// Add extended attribute to task
		Task task = asposeProject.RootTask.Children.Add("Task 1");

		// Define a duration attribute without lookup.
		ExtendedAttributeDefinition taskDurationAttributeDefinition = ExtendedAttributeDefinition.CreateTaskDefinition(ExtendedAttributeTask.Duration1, "New Duration");

		// Add new task and assign duration value to the previously defined duration attribute.
		ExtendedAttribute durationExtendedAttribute = taskDurationAttributeDefinition.CreateExtendedAttribute();

		durationExtendedAttribute.DurationValue = asposeProject.GetDuration(3.0, TimeUnitType.ElapsedDay);

		Task task2 = asposeProject.RootTask.Children.Add("Task 2");
		// Generate Extended Attribute from definition
		ExtendedAttribute text1TaskAttribute2 = myTextAttributeDefinition.CreateExtendedAttribute();
		text1TaskAttribute2.TextValue = "Text attribute value2";

		ExtendedAttribute durationExtendedAttribute2 = taskDurationAttributeDefinition.CreateExtendedAttribute();

		durationExtendedAttribute2.DurationValue = asposeProject.GetDuration(5.0, TimeUnitType.ElapsedMinute);

		asposeProject.Save("CreateExtendedAttributes_out.mpp", SaveFileFormat.MPP);


I have observed the sample code shared by you and request you to please share the details of issue or requirements on your end that you are looking in Aspose.Tasks to offer you. Please also provide the source file, generated and desired output file for reference as well.

here is an example of the solution used. From this solution removed the license file “Aspose.Tasks.lic”, it must be added.ConsoleProject.zip (48.5 KB)


I have observed the requirements shared. An issue with ID TASKSNET-3583 has been created 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.

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