Microsoft Project File Viewer for .NET

Load MPP, MPT, MPX and Microsoft Project XML files in C# and render project schedules as browser-ready HTML without Microsoft Project or Office Automation.

View Microsoft Project Files Programmatically in C#

Aspose.Tasks for .NET gives .NET developers a consistent API for loading project files and rendering their schedules for viewing. A C# application can open a project from a file or stream, select a project view, and export the result to HTML for use in a browser, internal portal, document preview service, or automated reporting workflow.

The viewer workflow runs entirely inside your .NET application. It does not require Microsoft Project, Microsoft Office Automation, or a desktop conversion utility on the host machine. This makes it suitable for ASP.NET applications, background services, desktop software, cloud workloads, and batch-processing pipelines.

Use the API when users need to inspect a project plan without editing the source document. The rendered output can expose task names, dates, dependencies, resources, assignments, progress, and Gantt chart data while leaving the original project file unchanged.

How the .NET Project Viewer Workflow Works

The Project class is the entry point for reading supported project-management files. After loading a document, configure HtmlSaveOptions to choose the view and control its layout, then call Project.Save to create the HTML output.

  1. Validate the uploaded file and copy it to controlled application storage or open it from a trusted stream.
  2. Load the project with the Project class.
  3. Select a presentation such as Gantt Chart, Task Usage, Resource Usage, Resource Sheet, or Task Sheet.
  4. Configure layout options such as content fitting, page range, date range, timescale, and embedded resources.
  5. Save the selected view as HTML and serve the generated files through your application.

For PDF or image previews, the same project model can be rendered with the corresponding save options. HTML is a practical choice when the result needs to be displayed directly in a web interface.

Supported Microsoft Project Viewer Formats

The main viewer supports the project formats covered by the dedicated pages below. Each page contains format-specific guidance and a focused C# example.

Choose a Project File Viewer

Open a format page for implementation details and C# code.

MPP (Microsoft Project plan files)
MPT (Microsoft Project template files)
MPX (Microsoft Project interchange files)
XML (Microsoft Project XML files)

Install Aspose.Tasks for .NET

Add the library from NuGet or use the Package Manager Console command below. The package can be referenced from supported .NET projects without installing Microsoft Project on the development or deployment machine.

Package Manager Console

PM> Install-Package Aspose.Tasks

Render an MPP File to HTML in C#

The following example loads a Microsoft Project file, selects the Gantt Chart presentation, fits long task content, and saves a browser-ready HTML view. The same loading and rendering pattern applies to supported MPT, MPX, and Microsoft Project XML inputs.

C# Code to View a Microsoft Project File as HTML

using Aspose.Tasks;
using Aspose.Tasks.Saving;
using Aspose.Tasks.Visualization;

string inputPath = Path.GetFullPath("project.mpp");
string outputPath = Path.GetFullPath("project-view.html");

var project = new Project(inputPath);
var options = new HtmlSaveOptions
{
    PresentationFormat = PresentationFormat.GanttChart,
    FitContent = true,
    IncludeProjectNameInTitle = true,
    IncludeProjectNameInPageHeader = true
};

project.Save(outputPath, options);

Control the Rendered Project View

HtmlSaveOptions provides controls for both the visible project data and the generated resources. Common viewer settings include:

  • PresentationFormat for Gantt Chart, Task Usage, Resource Usage, Resource Sheet, or Task Sheet output.
  • FitContent to increase row height when task or resource text would otherwise be truncated.
  • StartDate and EndDate to limit the rendered schedule period.
  • Timescale to control the timeline scale used by supported project views.
  • Pages to render selected pages instead of the complete project.
  • ExportCss, ExportFonts, and ExportImages to choose whether supporting resources are embedded or written separately.
  • ViewSettings when the output must use a specific view stored in the source project.

Choose only the fields and date range required by the viewer. Large schedules become easier to scan and faster to deliver when the rendered output is scoped to the user’s task.

Production Guidance for Project File Viewing

Treat project files received from users or external systems as untrusted input. Enforce upload-size limits, allow only formats supported by the workflow, generate unpredictable temporary names, and keep source files outside publicly served directories. Apply time and memory limits to background rendering jobs, especially when projects contain many tasks, resources, assignments, or embedded objects.

Do not rely on the filename extension alone. Validate the input by attempting to load it in a controlled process and return a clear error when the document is damaged, encrypted, or incompatible. Clean up temporary source files and generated HTML resources according to your application’s retention policy.

When HTML output is published to a web application, serve it from an isolated location and apply the same content-security and access-control rules used for other generated documents. Cache only outputs that are safe to reuse for the same authorized audience.

View Microsoft Project Files Online

For occasional viewing without writing code, use the free Microsoft Project Viewer . Upload a supported project file and inspect it in a browser. The online app is useful for manual checks, while Aspose.Tasks for .NET is intended for integrating the same type of workflow into your own applications and services.

Related Aspose.Tasks for .NET Resources

Frequently Asked Questions

Can I view MPP files in a .NET application without Microsoft Project?

Yes. Aspose.Tasks for .NET loads and renders MPP files without requiring Microsoft Project or Microsoft Office Automation on the host machine.

Which project formats can the .NET viewer open?

The dedicated viewer pages cover MPP, MPT, MPX, and Microsoft Project XML files. Aspose.Tasks also supports additional project-management formats for other processing and conversion workflows.

Can Aspose.Tasks render a project directly to HTML?

Yes. Load the source with the Project class, configure HtmlSaveOptions, and call Project.Save to produce HTML output that can be displayed in a browser.

Can I choose which project view is rendered?

Yes. You can select Gantt Chart, Task Usage, Resource Usage, Resource Sheet, or Task Sheet through PresentationFormat, or use ViewSettings to render a compatible view stored in the project.

Is the online viewer the same as the .NET API?

No. The online viewer is a ready-to-use browser application for manual viewing. Aspose.Tasks for .NET is a development library for adding project-file viewing and rendering to your own software.