Installation
Add Doconut to your .NET 8 project
The base Doconut viewer for .NET 8 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
dotnet add package Doconut.NET8The unversioned command installs the latest stable release. To reproduce the current 26.7.0 release exactly, pass the version as a separate option:
dotnet add package Doconut.NET8 --version 26.7.0Doconut.NET8 is the package ID. The .26.7.0 suffix belongs to the downloaded
Doconut.NET8.26.7.0.nupkg filename and is not part of the ID.
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.
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.
| Property | Default | Description |
|---|---|---|
ShowDoconutInfo | false | When true, a request with no token returns a version banner instead of a 404. Useful as a smoke check; leave off in production. |
UnsafeMode | false | When 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. |
LicenseStream | null | License as a stream, read once at startup. |
ResetLicense | false | Reserved compatibility flag. The current .NET 8 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.
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?