Back to Aspnetcore

.NET 10 validation package information

aspnetcore/includes/validation-package-net10.md

latest667 B
Original Source
<!-- USED in validation docs for .NET 10 -->

Validation in .NET 10

In .NET 10, the unified validation APIs have been moved to the Microsoft.Extensions.Validation NuGet package. This change makes the validation APIs available outside of ASP.NET Core HTTP scenarios.

To use the Microsoft.Extensions.Validation APIs:

  • Add the following package reference:

    xml
    <PackageReference Include="Microsoft.Extensions.Validation" Version="10.0.0" />
    

    The functionality remains the same but now requires an explicit package reference.

  • Register validation services with dependency injection:

    csharp
    builder.Services.AddValidation();