net.sf.mpxj 12.10.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package net.sf.mpxj --version 12.10.0
NuGet\Install-Package net.sf.mpxj -Version 12.10.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="net.sf.mpxj" Version="12.10.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add net.sf.mpxj --version 12.10.0
#r "nuget: net.sf.mpxj, 12.10.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install net.sf.mpxj as a Cake Addin
#addin nuget:?package=net.sf.mpxj&version=12.10.0

// Install net.sf.mpxj as a Cake Tool
#tool nuget:?package=net.sf.mpxj&version=12.10.0

MPXJ

MPXJ is a Java library which allows a variety of project file formats and databases to be read and written. This NuGet package uses IKVM to translate the Java library into a .Net assembly. You can find details of the classes and methods in the Javadocs, and more general documentation on the MPXJ website.

This package is a direct conversion of the Java version of MPXJ into a .Net assembly. As a result you'll notice the use of getter and setter methods rather than properties, and method names starting with lower case letters. Two additional versions of this assembly are available from NuGet: MPXJ for C# and MPXJ for VB which use properties and naming conventions which will be more familiar to you when working in C# and VB respectively.

After installing this package you can either work with some of the simple built-in utilities provided by MPXJ for tasks like file format conversion:

using net.sf.mpxj.sample;

new MpxjConvert().process("example.mpp", "example.mpx");

or you can interact directly with the object model exposed by MPXJ to extract data:

using net.sf.mpxj.reader;
using Task = net.sf.mpxj.Task;

var project = new UniversalProjectReader().read("example.mpp");

System.Console.WriteLine("Tasks");
foreach (Task task in project.getTasks())
{
    System.Console.WriteLine(task.getID().toString() + "\t" + task.getName());
}

or finally you can generate your own schedule:

using java.text;
using net.sf.mpxj;
using net.sf.mpxj.writer;

// In the example below we'll be generating an MSPDI
// file which we can import into Microsoft Project.
var filename = "example.xml";
var fileformat = FileFormat.MSPDI;


// Create a simple date format to allow us to easily set date values.
var df = new SimpleDateFormat("dd/MM/yyyy");

// Create a ProjectFile instance
var file = new ProjectFile();

// Add a default calendar called "Standard"
var calendar = file.addDefaultBaseCalendar();

// Add a holiday to the calendar to demonstrate calendar exceptions
calendar.addCalendarException(df.parse("13/03/2006"), df.parse("13/03/2006"));

// Retrieve the project properties and set the start date. Note Microsoft
// Project appears to reset all task dates relative to this date, so this
// date must match the start date of the earliest task for you to see
// the expected results. If this value is not set, it will default to
// today's date.
var properties = file.getProjectProperties();
properties.setStartDate(df.parse("01/01/2003"));

// Set a couple more properties just for fun
properties.setProjectTitle("Created by MPXJ");
properties.setAuthor("Jon Iles");

// Let's create an alias for TEXT1
var customFields = file.getCustomFields();
var field = customFields.getOrCreate(TaskField.TEXT1);
field.setAlias("My Custom Field");

// Add resources
var resource1 = file.addResource();
resource1.setName("Resource1");

var resource2 = file.addResource();
resource2.setName("Resource2");
resource2.setMaxUnits(java.lang.Double.valueOf(50.0));

// Create a summary task
var task1 = file.addTask();
task1.setName("Summary Task");

// Create the first sub task
var task2 = task1.addTask();
task2.setName("First Sub Task");
task2.setDuration(Duration.getInstance(10.5, TimeUnit.DAYS));
task2.setStart(df.parse("01/01/2003"));
task2.setText(1, "My Custom Value 1");

// We'll set this task up as being 50% complete. If we have no resource
// assignments for this task, this is enough information for MS Project.
// If we do have resource assignments, the assignment record needs to
// contain the corresponding work and actual work fields set to the
// correct values in order for MS project to mark the task as complete
// or partially complete.
task2.setPercentageComplete(java.lang.Double.valueOf(50.0));
task2.setActualStart(df.parse("01/01/2003"));

// Create the second sub task
var task3 = task1.addTask();
task3.setName("Second Sub Task");
task3.setStart(df.parse("11/01/2003"));
task3.setDuration(Duration.getInstance(10, TimeUnit.DAYS));
task3.setText(1, "My Custom Value 2");

// Link these two tasks
task3.addPredecessor(task2, RelationType.FINISH_START, null);

// Add a milestone
var milestone1 = task1.addTask();
milestone1.setName("Milestone");
milestone1.setStart(df.parse("21/01/2003"));
milestone1.setDuration(Duration.getInstance(0, TimeUnit.DAYS));
milestone1.addPredecessor(task3, RelationType.FINISH_START, null);

// This final task has a percent complete value, but no
// resource assignments. This is an interesting case it it requires
// special processing to generate the MSPDI file correctly.
var task4 = file.addTask();
task4.setName("Next Task");
task4.setDuration(Duration.getInstance(8, TimeUnit.DAYS));
task4.setStart(df.parse("01/01/2003"));
task4.setPercentageComplete(java.lang.Double.valueOf(70.0));
task4.setActualStart(df.parse("01/01/2003"));

// Assign resources to tasks
var assignment1 = task2.addResourceAssignment(resource1);
var assignment2 = task3.addResourceAssignment(resource2);

// As the first task is partially complete, and we are adding
// a resource assignment, we must set the work and actual work
// fields in the assignment to appropriate values, or MS Project
// won't recognise the task as being complete or partially complete
assignment1.setWork(Duration.getInstance(80, TimeUnit.HOURS));
assignment1.setActualWork(Duration.getInstance(40, TimeUnit.HOURS));

// If we were just generating an MPX file, we would already have enough
// attributes set to create the file correctly. If we want to generate
// an MSPDI file, we must also set the assignment start dates and
// the remaining work attribute. The assignment start dates will normally
// be the same as the task start dates.
assignment1.setRemainingWork(Duration.getInstance(40, TimeUnit.HOURS));
assignment2.setRemainingWork(Duration.getInstance(80, TimeUnit.HOURS));
assignment1.setStart(df.parse("01/01/2003"));
assignment2.setStart(df.parse("11/01/2003"));

// Write a 100% complete task
var task5 = file.addTask();
task5.setName("Last Task");
task5.setDuration(Duration.getInstance(3, TimeUnit.DAYS));
task5.setStart(df.parse("01/01/2003"));
task5.setPercentageComplete(java.lang.Double.valueOf(100.0));
task5.setActualStart(df.parse("01/01/2003"));

// Write a 100% complete milestone
var task6 = file.addTask();
task6.setName("Last Milestone");
task6.setDuration(Duration.getInstance(0, TimeUnit.DAYS));
task6.setStart(df.parse("01/01/2003"));
task6.setPercentageComplete(java.lang.Double.valueOf(100.0));
task6.setActualStart(df.parse("01/01/2003"));

// Write the file
new UniversalProjectWriter(fileformat).write(file, filename);
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp3.1 is compatible. 
.NET Framework net45 is compatible.  net451 was computed.  net452 was computed.  net46 was computed.  net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
12.10.1 342 5/22/2024
12.10.0 415 5/13/2024
12.9.3 767 4/24/2024
12.9.2 661 4/19/2024
12.9.1 533 4/17/2024
12.9.0 1,334 4/11/2024
12.8.1 668 3/11/2024
12.8.0 1,404 3/4/2024
12.7.0 467 2/7/2024
12.6.0 2,831 1/22/2024
12.5.0 1,729 12/18/2023
12.4.0 1,893 11/23/2023
12.3.0 731 11/7/2023
12.2.0 1,266 10/12/2023
12.1.3 1,014 9/25/2023
12.1.2 436 9/21/2023
12.1.1 2,521 8/23/2023
12.1.0 942 8/22/2023
12.0.2 1,739 7/25/2023
12.0.1 768 7/21/2023
12.0.0 1,221 6/29/2023
11.5.4 1,744 6/27/2023
11.5.3 2,056 6/19/2023
11.5.2 922 6/8/2023
11.5.1 1,264 5/24/2023
11.5.0 937 5/19/2023
11.4.0 2,922 5/8/2023
11.3.2 2,035 4/29/2023
11.3.1 1,772 4/21/2023
11.3.0 1,456 4/12/2023
11.2.0 2,306 3/13/2023
11.1.0 1,029 2/15/2023
11.0.0 473 2/8/2023
10.16.2 565 1/29/2023
10.16.1 494 1/26/2023
10.16.0 509 1/24/2023
10.15.0 1,396 1/11/2023
10.14.1 1,739 11/25/2022
10.14.0 694 11/21/2022
10.13.0 675 11/16/2022
10.12.0 788 11/1/2022
10.11.0 1,383 9/27/2022
10.10.0 792 9/13/2022
10.9.1 830 8/31/2022
10.9.0 755 8/23/2022
10.8.0 757 8/17/2022
10.7.0 779 8/9/2022
10.6.2 841 6/29/2022
10.6.1 785 6/14/2022
10.6.0 1,026 6/8/2022
10.5.0 810 5/24/2022
10.4.0 823 5/9/2022
10.3.0 794 4/29/2022
10.2.0 4,809 3/6/2022
10.1.0 1,318 1/29/2022
10.0.5 871 1/11/2022
10.0.4 1,495 1/7/2022
10.0.3 742 12/22/2021
10.0.2 773 12/16/2021
10.0.1 762 12/10/2021
10.0.0 753 12/1/2021
9.8.3 788 11/30/2021
9.8.2 901 11/1/2021
9.8.1 838 10/13/2021
9.8.0 882 9/30/2021
9.7.0 793 9/28/2021
9.6.0 842 9/13/2021
9.5.2 844 8/22/2021
9.5.1 864 7/2/2021
9.5.0 869 6/30/2021
9.4.0 869 6/11/2021
9.3.1 865 5/18/2021
9.3.0 846 5/6/2021
9.2.6 855 4/26/2021
9.2.5 864 4/20/2021
9.2.4 852 4/9/2021
9.2.3 837 4/8/2021
9.2.2 817 4/7/2021
9.2.1 863 4/4/2021
9.2.0 845 3/30/2021
9.1.0 980 3/11/2021
9.0.0 904 2/18/2021
8.5.1 1,127 1/8/2021
8.5.0 979 1/6/2021
8.4.0 912 12/29/2020
8.3.5 1,012 12/15/2020
8.3.4 957 12/10/2020
8.3.3 1,004 11/24/2020
8.3.2 1,185 10/22/2020
8.3.1 1,008 10/14/2020
8.3.0 1,006 10/13/2020
8.2.0 1,147 9/9/2020
8.1.4 1,105 8/31/2020
8.1.3 1,086 6/25/2020
8.1.2 1,026 6/18/2020
8.1.1 991 6/17/2020
8.1.0 1,040 6/11/2020
8.0.8 1,060 4/20/2020
8.0.6 1,328 3/5/2020
8.0.5 1,121 2/7/2020
8.0.4 1,081 2/6/2020
8.0.3 1,115 1/27/2020
8.0.2 1,083 1/16/2020
8.0.1 1,098 1/5/2020
8.0.0 1,126 1/2/2020
7.9.8 1,067 12/27/2019
7.9.7 1,098 11/25/2019
7.9.5 1,049 11/19/2019
7.9.4 1,073 11/8/2019
7.9.3 1,176 9/10/2019
7.9.2 1,913 8/19/2019
7.9.1 1,222 7/1/2019
7.9.0 1,110 7/1/2019
7.8.4 1,110 6/27/2019
7.8.3 1,188 5/24/2019
7.8.2 1,128 5/19/2019
7.8.1 1,378 2/13/2019
7.8.0 1,305 1/18/2019
7.7.1 1,786 10/23/2018
7.7.0 1,332 10/12/2018
7.6.3 1,303 10/4/2018
7.6.2 1,377 8/30/2018
7.6.1 1,372 8/29/2018
7.6.0 1,593 7/13/2018
7.5.0 1,575 6/19/2018
7.4.4 1,508 6/6/2018
7.4.3 1,565 5/25/2018
7.4.2 1,609 4/30/2018
7.4.1 1,641 4/16/2018
7.4.0 1,717 3/23/2018
7.3.0 2,084 3/12/2018
7.2.1 1,601 1/26/2018
7.2.0 1,556 1/18/2018
7.1.0 1,599 1/3/2018
7.0.3 1,483 12/21/2017
7.0.2 1,472 11/20/2017
7.0.1 1,481 11/20/2017
7.0.0 1,524 11/8/2017
6.2.1 1,512 10/11/2017
6.2.0 1,429 10/6/2017
6.1.2 1,480 9/12/2017
6.1.0 1,540 7/28/2017
6.0.0 1,470 7/22/2017
5.14.0 1,462 7/13/2017
5.13.0 1,484 6/27/2017
5.12.0 1,473 6/26/2017
5.11.0 1,510 6/20/2017
5.10.0 1,511 5/23/2017
5.9.0 1,596 4/27/2017
5.8.0 1,515 4/21/2017
5.7.1 1,516 3/22/2017
5.7.0 1,509 3/20/2017
5.6.5 1,561 3/7/2017
5.6.4 1,568 2/16/2017
5.6.3 1,590 2/8/2017
5.6.2 1,521 2/6/2017
5.6.1 1,537 2/3/2017
5.6.0 1,495 1/29/2017
5.5.9 1,516 1/27/2017
5.5.8 1,557 1/23/2017
5.5.7 1,564 1/13/2017
5.5.6 1,538 1/6/2017
5.5.5 1,553 1/6/2017
5.5.4 1,701 12/1/2016
5.5.3 1,558 11/29/2016
5.5.2 1,900 11/2/2016
5.5.1 1,537 10/14/2016
5.5.0 1,490 10/13/2016
5.4.0 1,506 10/6/2016
5.3.3 1,571 8/31/2016
5.3.2 1,534 8/31/2016
5.3.1 1,630 7/1/2016
5.3.0 1,647 6/10/2016
5.2.2 2,101 3/11/2016
5.2.1 2,103 2/11/2016
5.2.0 1,876 2/8/2016
5.1.18 1,933 1/26/2016
5.1.17 1,897 12/30/2015
5.1.16 1,918 12/18/2015
5.1.15 1,926 12/16/2015
5.1.13 2,056 11/26/2015
5.1.12 1,965 11/16/2015
5.1.11 1,983 11/12/2015
5.1.10 2,202 9/9/2015
5.1.9 2,018 8/30/2015
5.1.5 2,152 6/5/2015
5.1.4 1,818 6/3/2015
5.1.0 1,991 5/18/2015
5.0.0 1,924 5/6/2015
4.7.6 1,985 3/18/2015
4.7.5 2,064 2/27/2015
4.7.4 2,345 2/25/2015
4.7.3 2,486 12/23/2014
4.7.1 2,181 12/8/2014
4.7.0 1,968 12/4/2014
4.6.2 2,207 11/11/2014
4.6.1 1,941 10/17/2014