Article · 10 picks · Published

10 open source libraries every .NET developer should know

The .NET base class library covers a lot, but most real projects still pull in a handful of community packages. This list is the ten we would reach for first in a new ASP.NET Core or console project in late 2026, one per job, from logging to benchmarks.

Several well-known libraries moved to paid licenses in the last two years, so every pick here is open source and free for commercial use today. We checked each license, the latest stable version and the setup code against the project's own repository, documentation and NuGet page on December 5, 2026.

How we chose

  • Open source under a permissive license (MIT or Apache 2.0), with no fee for commercial use.
  • Actively maintained: a stable or preview release in the last twelve months.
  • Solves a job most teams have, and does it better or more simply than the built-in option.
  • Works with current .NET versions and the usual hosting model (WebApplication, dependency injection, ILogger).

Logging

Serilog

Structured logging. Message templates such as "Order {OrderId} shipped" keep OrderId as a named property, so your logs become events you can filter and query. Sinks write to the console, files, Seq, OpenTelemetry and many other destinations.

Why it made the list: It plugs into Microsoft.Extensions.Logging with one line, so code that already uses ILogger<T> keeps working while you gain enrichers, sinks and request logging.

License
Apache 2.0
Version at review
Serilog 4.4.2, Serilog.AspNetCore 11.0.1
Install
dotnet add package Serilog.AspNetCore
Program.cs
using Serilog;

Log.Logger = new LoggerConfiguration()
    .WriteTo.Console()
    .CreateLogger();

var builder = WebApplication.CreateBuilder(args);
builder.Services.AddSerilog();

var app = builder.Build();
app.UseSerilogRequestLogging();
app.MapGet("/", () => "Hello World!");
app.Run();

Worth knowing: The separate serilog-aspnetcore repository was archived on December 4, 2026. Its code now lives in the main Serilog repository, and the Serilog.AspNetCore package continues as before.

Validation

FluentValidation

Strongly typed validation rules written as code in a validator class, instead of attributes scattered across your models. Rules can be conditional, async and reused across validators, and failures come back as a structured result.

Why it made the list: Validation logic stays in one testable place, separate from the model, which keeps request types clean as rules grow.

License
Apache 2.0
Version at review
12.2.0 (targets .NET 8 and later)
Install
dotnet add package FluentValidation
Example
using FluentValidation;

public class CustomerValidator : AbstractValidator<Customer>
{
    public CustomerValidator()
    {
        RuleFor(x => x.Surname).NotEmpty();
        RuleFor(x => x.Forename).NotEmpty().WithMessage("Please specify a first name");
    }
}

var result = new CustomerValidator().Validate(customer);
if (!result.IsValid) { /* result.Errors lists each failure */ }

Worth knowing: The maintainer asks companies that use FluentValidation commercially to sponsor the project. This is a request, not a license condition. Projects still on older runtimes should stay on version 11.

Data access

Dapper

A micro-ORM: extension methods on DbConnection that run your SQL and map the rows to objects, with parameters passed as an anonymous object. You write the SQL; Dapper removes the DataReader boilerplate.

Why it made the list: It sits comfortably next to EF Core for reporting queries, hot paths and existing stored procedures, where you want exact control over the SQL with very little overhead.

License
Apache 2.0
Version at review
2.1.100
Install
dotnet add package Dapper
Example
using Dapper;

var customers = (await connection.QueryAsync<Customer>(
    "select * from Customers where Region = @region",
    new { region })).AsList();

Worth knowing: Strings are sent as nvarchar by default. Against a varchar column on SQL Server, that implicit conversion can stop an index from being used; pass a DbString with IsAnsi = true for those columns.

Object mapping

Mapperly

A source generator for object-to-object mapping. You declare a partial method and Mapperly writes the mapping code at compile time, so there is no reflection at runtime and you can read exactly what it generated.

Why it made the list: It is fast, works with trimming and Native AOT, reports unmapped properties as build diagnostics, and is a free choice now that AutoMapper needs a paid license for most commercial use.

License
Apache 2.0
Version at review
4.3.1 (5.0 in preview)
Install
dotnet add package Riok.Mapperly
Example
using Riok.Mapperly.Abstractions;

[Mapper]
public partial class CarMapper
{
    public partial CarDto CarToCarDto(Car car);
}

var dto = new CarMapper().CarToCarDto(car);

HTTP clients

Refit

Describe a REST API as a C# interface with attributes such as [Get("/people/{id}")], and Refit generates the client. Version 17 generates the implementation at build time and works with System.Text.Json source generation.

Why it made the list: Typed API clients without hand-written HttpClient plumbing, registered through IHttpClientFactory so they pick up the same handlers, resilience and telemetry as the rest of your app.

License
MIT
Version at review
17.1.0
Install
dotnet add package Refit
dotnet add package Refit.HttpClientFactory
Example
using System.Text.Json.Serialization;
using Refit;

public interface IPeopleApi
{
    [Get("/people/{id}")]
    Task<Person> GetPersonAsync(int id, CancellationToken cancellationToken);
}

[JsonSerializable(typeof(Person))]
partial class AppJsonContext : JsonSerializerContext { }

// Program.cs
builder.Services.AddRefitGeneratedClient<IPeopleApi>(AppJsonContext.Default)
    .ConfigureHttpClient(client => client.BaseAddress = new Uri("https://api.example.com"));

Worth knowing: If you are upgrading an older project, the reflection-based AddRefitClient<T> registration now needs the separate Refit.HttpClientFactory.Reflection package. The generated registration above is the default path.

Messaging and mediator

Wolverine

An in-process mediator and a message bus in one library. Handlers are plain classes found by naming convention, with no interfaces to implement, and the same handlers can run from local queues or external brokers such as RabbitMQ and Azure Service Bus.

Why it made the list: It covers what many teams used MediatR and MassTransit for, both of which are now commercial, and adds durable messaging with a transactional outbox when you need it.

License
MIT
Version at review
6.67.0 (7.0 in release candidate)
Install
dotnet add package WolverineFx
Example
using Wolverine;

var builder = WebApplication.CreateBuilder(args);
builder.Host.UseWolverine();

var app = builder.Build();
app.MapPost("/issues", (CreateIssue command, IMessageBus bus) =>
    bus.InvokeAsync<IssueCreated>(command));
app.Run();

public record CreateIssue(string Title);
public record IssueCreated(Guid Id);

// Discovered by convention: no registration needed.
public class CreateIssueHandler
{
    public IssueCreated Handle(CreateIssue command) => new(Guid.NewGuid());
}

Worth knowing: Wolverine 7.0 is in release candidate, so check the migration guide before upgrading. JasperFx Software sells support and consulting; the library itself is MIT.

API reference

Scalar

An interactive API reference for the OpenAPI document ASP.NET Core generates with Microsoft.AspNetCore.OpenApi. You can browse endpoints, see schemas and send test requests from the browser.

Why it made the list: The ASP.NET Core templates stopped including Swagger UI in .NET 9. Scalar is a modern replacement that takes two lines on top of the built-in OpenAPI support.

License
MIT
Version at review
Scalar.AspNetCore 3.4.3
Install
dotnet add package Scalar.AspNetCore
Program.cs
using Scalar.AspNetCore;

builder.Services.AddOpenApi();
var app = builder.Build();

if (app.Environment.IsDevelopment())
{
    app.MapOpenApi();
    app.MapScalarApiReference(); // browse to /scalar
}

Worth knowing: Scalar's optional AI agent feature has a small free tier on localhost and needs an Agent key in production. The API reference itself does not need it.

Integration testing

Testcontainers for .NET

Starts real dependencies, such as PostgreSQL, SQL Server, Redis or RabbitMQ, in throwaway Docker containers from your test code, and removes them afterwards. Ready-made modules handle ports, credentials and readiness checks.

Why it made the list: Integration tests run against the same database engine you ship on, instead of an in-memory fake that behaves differently, and they work the same on a laptop and in CI.

License
MIT
Version at review
4.17.0
Install
dotnet add package Testcontainers.PostgreSql
Example
using Testcontainers.PostgreSql;

await using var postgres = new PostgreSqlBuilder("postgres:17").Build();
await postgres.StartAsync();

var connectionString = postgres.GetConnectionString();
// Point your DbContext or Dapper connection at connectionString.

Worth knowing: Developer machines and CI agents need Docker or a compatible container runtime.

Benchmarking

BenchmarkDotNet

Turns methods into reliable micro-benchmarks. It handles warm-up, runs many iterations in a separate process, applies statistics and can report allocations, so you compare real numbers instead of a Stopwatch guess.

Why it made the list: It is the standard tool the .NET runtime team and most library authors use. Before you optimize a hot path, measure it here.

License
MIT
Version at review
0.15.8 (0.16 in preview)
Install
dotnet add package BenchmarkDotNet
Program.cs
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;

BenchmarkRunner.Run<JoinBenchmarks>();

[MemoryDiagnoser]
public class JoinBenchmarks
{
    private readonly string[] words = Enumerable.Repeat("dotnet", 100).ToArray();

    [Benchmark(Baseline = true)]
    public string Concat() => string.Concat(words);

    [Benchmark]
    public string Join() => string.Join("", words);
}

Worth knowing: Always run benchmarks in Release mode: dotnet run -c Release. The version number is still below 1.0, but the library has been stable and widely used for years.

Console apps

Spectre.Console

Rich output for console apps: colored markup, tables, trees, progress bars, spinners and interactive prompts, with sensible fallbacks when the terminal cannot show colors.

Why it made the list: Internal tools and CLIs become far easier to read and use, with very little code.

License
MIT
Version at review
0.57.2
Install
dotnet add package Spectre.Console
Example
using Spectre.Console;

AnsiConsole.MarkupLine("[bold blue]Welcome[/] to [green]Spectre.Console[/]!");

var table = new Table()
    .AddColumn("Feature")
    .AddColumn("Description")
    .AddRow("[green]Markup[/]", "Rich text with colors and styles");
AnsiConsole.Write(table);

Worth knowing: For command-line parsing with commands and options, add the companion Spectre.Console.Cli package.

Popular libraries that changed their terms

These are still widely used and the source is still public, but check the terms before you add or upgrade them in a commercial product.

  • AutoMapper and MediatR: current versions need a paid license for most commercial use. Mapperly and Wolverine above are free alternatives.
  • Staying on the last free AutoMapper (14.0.0) is not a safe way to wait: the high-severity denial-of-service flaw CVE-2026-32933, caused by uncontrolled recursion on deeply nested objects, is fixed only in the commercially licensed 15.1.1 and 16.1.1 releases.
  • MassTransit: version 9 is commercial. Version 8 remains Apache 2.0.
  • FluentAssertions: version 8 needs a paid license for commercial use. Version 7 remains Apache 2.0.
  • Polly: still BSD 3-Clause, but since November 16, 2026 companies earning at least US $20,000 from a product that uses Polly are asked to pay a US $20 per month maintenance fee. Per the Polly README, it applies only to the next major version released after that date and only to direct references; using Polly through Microsoft.Extensions.Http.Resilience is not affected.

Check before you upgrade

A NuGet package reference does not ask you to accept a license, so a license change can arrive with a routine version bump. Before upgrading a dependency across a major version, look at the License field on its nuget.org page and the LICENSE file in its repository.

Further reading from our library

Articles on these tools that we have featured in The .NET Insider.

Reviewed . Versions, licenses and setup steps were checked against each project's repository, documentation and package page on that date. Project names and trademarks belong to their owners; dotnetdevs.io is not affiliated with them.