RepletoryLib.Api.Versioning 1.0.0

dotnet add package RepletoryLib.Api.Versioning --version 1.0.0
                    
NuGet\Install-Package RepletoryLib.Api.Versioning -Version 1.0.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="RepletoryLib.Api.Versioning" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="RepletoryLib.Api.Versioning" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="RepletoryLib.Api.Versioning" />
                    
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 RepletoryLib.Api.Versioning --version 1.0.0
                    
#r "nuget: RepletoryLib.Api.Versioning, 1.0.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.
#:package RepletoryLib.Api.Versioning@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=RepletoryLib.Api.Versioning&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=RepletoryLib.Api.Versioning&version=1.0.0
                    
Install as a Cake Tool

RepletoryLib.Api.Versioning

URL segment and header-based API versioning for ASP.NET Core.

Part of the RepletoryLib ecosystem -- standalone, reusable .NET 10 libraries with zero business logic.

NuGet .NET 10 License: MIT


Overview

RepletoryLib.Api.Versioning configures Asp.Versioning for ASP.NET Core with URL segment versioning (/api/v1/..., /api/v2/...) and header-based versioning. It integrates with Swagger to generate versioned API documentation.

Key Features

  • URL segment versioning -- /api/v1/products, /api/v2/products
  • Header versioning -- api-version: 2.0 header support
  • Version reporting -- Response headers indicate supported API versions
  • Default version -- Configurable default when version is unspecified

Installation

dotnet add package RepletoryLib.Api.Versioning

Dependencies

Package Type
RepletoryLib.Common RepletoryLib
Asp.Versioning.Mvc NuGet
Asp.Versioning.Mvc.ApiExplorer NuGet

Quick Start

using RepletoryLib.Api.Versioning;

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

Configuration

VersioningOptions

Property Type Default Description
DefaultVersion string "1.0" Default API version when unspecified
AssumeDefaultVersionWhenUnspecified bool true Use default version if client doesn't specify
ReportApiVersions bool true Include api-supported-versions header in responses

Usage Examples

Versioned Controllers

using Asp.Versioning;

[ApiController]
[Route("api/v{version:apiVersion}/[controller]")]
[ApiVersion("1.0")]
public class ProductsV1Controller : ControllerBase
{
    [HttpGet]
    public IActionResult GetProducts() => Ok(new[] { "Widget v1" });
}

[ApiController]
[Route("api/v{version:apiVersion}/[controller]")]
[ApiVersion("2.0")]
public class ProductsV2Controller : ControllerBase
{
    [HttpGet]
    public IActionResult GetProducts() => Ok(new[] { new { Name = "Widget", Version = 2 } });
}

Requests:

  • GET /api/v1/products["Widget v1"]
  • GET /api/v2/products[{"name":"Widget","version":2}]

Custom Configuration

builder.Services.AddRepletoryVersioning(options =>
{
    options.DefaultVersion = "2.0";
    options.AssumeDefaultVersionWhenUnspecified = false;
});

Integration with Other RepletoryLib Packages

Package Relationship
RepletoryLib.Common Direct dependency
RepletoryLib.Api.Swagger Generates per-version Swagger documents

License

This project is licensed under the MIT License.

Copyright (c) 2024-2026 Repletory.


For complete documentation, infrastructure setup, and configuration reference, see the RepletoryLib main repository.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  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
1.0.0 145 3/2/2026