Error exporting to MS Project casting cost to number


I tried exporting my project to MS Project (text and XML) and got an error. I have not used costs in this project, though I may have played around with a cost in one task, but I’ve now confirmed that all my tasks are “Set explicitly: 0.0” which was the default. All my resources have cost 0.

Here’s the last bit of the log file with a backtrace:

WARNING: Export failure. Failed subtask: Export project
java.lang.RuntimeException: Export failure. Failed subtask: Export project
at net.sourceforge.ganttproject.export.ExporterBase$
at org.bardsoftware.impl.eclipsito.JobManagerImpl$
at Source)
Caused by: java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Number
at net.sf.mpxj.Task.getCost(
at net.sf.mpxj.mspdi.MSPDIWriter.writeTask(
at net.sf.mpxj.mspdi.MSPDIWriter.writeTasks(
at net.sf.mpxj.mspdi.MSPDIWriter.write(
at net.sf.mpxj.writer.AbstractProjectWriter.write(
at biz.ganttproject.impex.msproject2.ExporterToMsProjectFile$
at net.sourceforge.ganttproject.export.ExporterBase$
… 2 more

I’m running GanttProject 2.8.5 Pilsen (build 2179) on Win 7

(Dmitry Barashev) #2

Please share the project file.


Here you go.

Sanitized project plan.gan (18.3 KB)

(Dmitry Barashev) #4

You have a custom field with the name “Cost” and type “Text”. In MS Project model there is also a field named “Cost” with numeric type, that’s why the exporting code fails.

The easiest way to fix it is to delete your custom field or to set its type to Double. Save the file after that and restart GanttProject.

The fixed file (Cost type changed to Double) is attached.

Sanitized project plan.gan (18.3 KB)


That’s odd. I didn’t create that on purpose. I bet it crept in when I
exported to csv, added a bunch of rows, and imported.


(Dmitry Barashev) #6

Oh, good catch! Thanks for elaborating. I have submitted a bug report to the tracker:


FWIW, I was not able to export after changing the Cost field to Double, but
was after deleting it. I haven’t yet had a chance to see if it imports into
MS Project yet as I’m on vacation.