Scalar.AspNetCore.Microsoft 2.5.0

dotnet add package Scalar.AspNetCore.Microsoft --version 2.5.0
                    
NuGet\Install-Package Scalar.AspNetCore.Microsoft -Version 2.5.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="Scalar.AspNetCore.Microsoft" Version="2.5.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Scalar.AspNetCore.Microsoft" Version="2.5.0" />
                    
Directory.Packages.props
<PackageReference Include="Scalar.AspNetCore.Microsoft" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Scalar.AspNetCore.Microsoft --version 2.5.0
                    
#r "nuget: Scalar.AspNetCore.Microsoft, 2.5.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.
#addin nuget:?package=Scalar.AspNetCore.Microsoft&version=2.5.0
                    
Install Scalar.AspNetCore.Microsoft as a Cake Addin
#tool nuget:?package=Scalar.AspNetCore.Microsoft&version=2.5.0
                    
Install Scalar.AspNetCore.Microsoft as a Cake Tool

Scalar .NET API Reference Integration

Version Downloads Discord

This .NET package Scalar.AspNetCore provides an easy way to render beautiful API references based on OpenAPI/Swagger documents.

Made possible by the wonderful work of @captainsafia on building the integration and docs written for the Scalar & .NET integration. Thanks to @xC0dex for making it awesome.

Features

  • Stunning API Reference
  • Compatible with .NET 8 and above
  • Independent of OpenAPI document generators
  • Fully AOT (Ahead-of-Time) compatible

dotnet

Migration Guide

If you are upgrading from 2.1.x to 2.2.x, please refer to the migration guide. If you are upgrading from 1.x.x to 2.x.x, please refer to the migration guide.

Usage

  1. Install the package
dotnet add package Scalar.AspNetCore
  1. Add the using directive
using Scalar.AspNetCore;
  1. Configure your application

Add the following to Program.cs based on your OpenAPI generator:

For Microsoft.AspNetCore.OpenApi:

builder.Services.AddOpenApi();

if (app.Environment.IsDevelopment())
{
    app.MapOpenApi();
    app.MapScalarApiReference();
}

For Swashbuckle:

builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();

if (app.Environment.IsDevelopment())
{
    app.UseSwagger(options =>
    {
        options.RouteTemplate = "/openapi/{documentName}.json";
    });
    app.MapScalarApiReference();
}

For NSwag:

builder.Services.AddEndpointsApiExplorer();
builder.Services.AddOpenApiDocument();

if (app.Environment.IsDevelopment())
{
    app.UseOpenApi(options =>
    {
        options.Path = "/openapi/{documentName}.json";
    });
    app.MapScalarApiReference();
}

For FastEndpoints:

builder.Services.SwaggerDocument();

if (app.Environment.IsDevelopment())
{
    app.UseSwaggerGen(options =>
    {
        options.Path = "/openapi/{documentName}.json";
    });
    app.MapScalarApiReference();
}

You’re all set! 🎉 Visit /scalar to see the API Reference for the default OpenAPI document (v1).

If you have multiple OpenAPI documents, you can set them up with AddDocument or AddDocuments (see Multiple OpenAPI Documents).
To view a specific document, go to /scalar/{documentName} (like /scalar/v1 or /scalar/v2-beta).

Configuration

For detailed configuration options, refer to the integration documentation. This documentation focuses on the features provided by the package.

For more realistic examples and advanced usage scenarios, such as authentication, API versioning, and handling multiple documents, check out our extended examples documentation. This documentation is also useful if you need more context on what Scalar.AspNetCore is for.

OpenAPI extensions

Scalar provides additional packages to enhance OpenAPI document generation:

  • Scalar.AspNetCore.Microsoft: Implements transformers for Microsoft.AspNetCore.OpenApi
  • Scalar.AspNetCore.Swashbuckle: Implements filters for Swashbuckle

These packages enable advanced features like stability indicators and API Reference exclusions. See the dotnet integration documentation for details.

Development

Local

  1. Download .NET 9.0
  2. Jump to the package folder: cd integrations/aspnetcore
  3. Do a fresh build: dotnet build
  4. Run the tests: dotnet test

And see it in action here:

  1. Switch to the playground: cd playground/Scalar.AspNetCore.Playground
  2. Start the playground: dotnet run
  3. Open this URL in the browser: http://localhost:5056/scalar/

Docker

If you don't have the SDK installed or want to run the playground under a subpath, you can use Docker Compose:

  1. Run Docker Compose: docker compose up --build
  2. Open this URL in the browser: http://localhost:8080/api/scalar/

Community

We are API nerds. You too? Let’s chat on Discord: https://discord.gg/scalar

License

The source code in this repository is licensed under MIT.

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows 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
2.5.0 19 6/21/2025
2.4.22 133 6/19/2025
2.4.21 103 6/19/2025
2.4.20 113 6/19/2025
2.4.19 192 6/17/2025
2.4.18 132 6/17/2025
2.4.17 168 6/16/2025
2.4.16 247 6/14/2025
2.4.15 213 6/13/2025
2.4.14 212 6/13/2025
2.4.13 287 6/6/2025
2.4.12 87 6/6/2025
2.4.11 151 6/5/2025
2.4.9 137 6/5/2025
2.4.8 246 6/3/2025
2.4.7 178 5/30/2025
2.4.6 144 5/30/2025
2.4.5 148 5/29/2025
2.4.4 364 5/27/2025
2.4.3 431 5/23/2025
2.4.2 230 5/22/2025