Installation

Add Doconut to your .NET 6 project

The base Doconut viewer for .NET 6 ships as one NuGet package that plugs into any ASP.NET Core application. Optional plugins use separate packages. This page installs the base package and registers the middleware — the minimum needed before your first render.

Install the package

bash
dotnet add package Doconut.NET6

The unversioned command installs the latest stable release. To reproduce the current 26.7.0 release exactly, pass the version as a separate option:

bash
dotnet add package Doconut.NET6 --version 26.7.0

Doconut.NET6 is the package ID. The .26.7.0 suffix belongs to the downloaded Doconut.NET6.26.7.0.nupkg filename and is not part of the ID.

Identify the integration before upgrading

The Doconut.NET6 package ID has been used by both the classic and current .NET 6 integrations. Do not select documentation from the package name alone:

  • DocImage.axd, new Viewer(_cache, _accessor, ...), synchronous OpenDocument(...), and manually copied viewer scripts identify the classic integration;
  • AddDoconut(), UseDoconutResources(), an injected Viewer, and OpenDocumentAsync(...) identify the current integration documented here.

The translated classic setup manual remains available. Use the migration guide to change generations; a normal package update does not convert startup, viewer lifetime, or browser resources automatically.

Register Doconut

AddDoconut() is the only registration entry point — there is a single overload, and it wires the Viewer service, the license service, and the rendering infrastructure into the DI container.

Two middleware calls complete the setup, and their order matters: UseDoconutResources() must run before UseDoconut(). UseDoconut() is terminal middleware, so calling it first means every request to a /doconut-res asset never reaches the resources handler and 404s. The session wiring is required too — Doconut's default document security validates every page request against ASP.NET session state.

csharp
builder.Services.AddDoconut(options =>
{
    options.LicensePath = "doconut.lic";
});
builder.Services.AddSession(); // Doconut document security rides on ASP.NET session state

app.UseSession();          // call UseSession() before UseDoconut()
app.UseDoconutResources(); // must be registered before UseDoconut()
app.UseDoconut();

All options

DoconutOptions accepts the following settable properties. Every one is optional — the defaults below apply when a property is left unset.

PropertyDefaultDescription
ShowDoconutInfofalseWhen true, a request with no token returns a version banner instead of a 404. Useful as a smoke check; leave off in production.
UnsafeModefalseWhen true, skips the ASP.NET-session security check on page requests. Leave off in production.
MiddlewarePath"/doconut"Coordination value for the page-image endpoint. It is validated, but it does not mount a branch by itself; keep it aligned with the actual UseDoconut() mapping and the client BasePath.
ResourcesPath"/doconut-res"Where the embedded JS/CSS/image resources are served from.
LicensePath"" (empty string)Path to the license file. Empty means fall through to the next source, then auto-search.
LicenseContent"" (empty string)Raw license content — from an environment variable, a secret manager, or a database.
LicenseStreamnullLicense as a stream, read once at startup.
ResetLicensefalseReserved compatibility flag. The current .NET 6 services read the license during AddDoconut(); restart the app after replacing a license.

License precedence when more than one source is set: LicenseStream beats LicenseContent beats LicensePath beats auto-search — see License Setup.

csharp
builder.Services.AddDoconut(options =>
{
    options.LicensePath     = "doconut.lic";
    options.MiddlewarePath  = "/doconut";     // coordinate with app mapping and client BasePath
    options.ResourcesPath   = "/doconut-res"; // where the viewer's JS/CSS/images are served from
    options.UnsafeMode      = false;          // keep session security on
    options.ShowDoconutInfo = false;
});

Next steps

  • Quick Start — open your first document and render it in the browser.
  • License Setup — where Doconut looks for your license file.

Was this page helpful?