Install
Add the SharpDocs package to an ASP.NET Core app.
SharpDocs targets net10.0 and references Microsoft.AspNetCore.App as a framework reference, so the host must be a compatible ASP.NET Core app.
Add the package
dotnet add package SharpDocs
If you're consuming a local build, add the artifacts/ folder as a NuGet source:
dotnet nuget add source ./artifacts --name SharpDocs-local
Wire it up
In Program.cs:
using SharpDocs;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddSharpDocs(builder.Configuration);
var app = builder.Build();
app.UseStaticFiles();
app.UseRouting();
app.MapSharpDocs();
app.Run();
That's the whole host. AddSharpDocs() registers an internal hosted service that warms the docs index and NuGet source before Kestrel binds, so the first request never pays a disk-scan cost. MapSharpDocs() registers routes that match your mode (single- or multi-project, decided by sharpdocs.json).
Configure
In appsettings.json:
{
"SharpDocs": {
"DocsRoot": "site",
"ArtifactsRoot": "artifacts",
"NavLinks": [
{ "Label": "Packages", "Href": "/packages" },
{ "Label": "NuGet Feed", "Href": "/v3/index.json" }
]
}
}
Relative paths are resolved against IHostEnvironment.ContentRootPath. In multi-project mode ArtifactsRoot is ignored — each project declares its own artifacts path inside its sharpdocs.json.
Next: Your first site.