![]() |
VOOZH | about |
dotnet add package Microsoft.Extensions.Options.DataAnnotations --version 10.0.9
NuGet\Install-Package Microsoft.Extensions.Options.DataAnnotations -Version 10.0.9
<PackageReference Include="Microsoft.Extensions.Options.DataAnnotations" Version="10.0.9" />
<PackageVersion Include="Microsoft.Extensions.Options.DataAnnotations" Version="10.0.9" />Directory.Packages.props
<PackageReference Include="Microsoft.Extensions.Options.DataAnnotations" />Project file
paket add Microsoft.Extensions.Options.DataAnnotations --version 10.0.9
#r "nuget: Microsoft.Extensions.Options.DataAnnotations, 10.0.9"
#:package Microsoft.Extensions.Options.DataAnnotations@10.0.9
#addin nuget:?package=Microsoft.Extensions.Options.DataAnnotations&version=10.0.9Install as a Cake Addin
#tool nuget:?package=Microsoft.Extensions.Options.DataAnnotations&version=10.0.9Install as a Cake Tool
Microsoft.Extensions.Options.DataAnnotations is a library that adds extra validation functionality to configuration options using data annotations.
It allows to apply validation rules to configuration classes to ensure they are correctly configured before the application starts running.
This way, misconfiguration issues are catched early during the application startup rather than facing them later in production.
While configuring services, chain the ValidateDataAnnotations() and ValidateOnStart() methods to the AddOptions method for your configuration class.
Here is a simple example demonstrating how to validate options on application startup:
services
.AddOptions<MyOptions>()
.ValidateDataAnnotations()
.ValidateOnStart();
In the configuration class, use data annotations to specify the validation rules.
For instance, in the following MyOptions class, the Name property is marked as required:
using System.ComponentModel.DataAnnotations;
public class MyOptions
{
[Required(AllowEmptyStrings = false)]
public string Name { get; set; }
}
With this setup, an error indicating that the Name field is required will be thrown upon startup if it hasn't been configured.
The main types provided by this library are:
Microsoft.Extensions.Options.DataAnnotationsValidateOptions<TOptions>Microsoft.Extensions.DependencyInjection.OptionsBuilderDataAnnotationsExtensionsCore options: Microsoft.Extensions.Options
Microsoft.Extensions.Options.DataAnnotations is released as open source under the MIT license. Bug reports and contributions are welcome at the GitHub repository.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 net5.0 was computed. net5.0-windows net5.0-windows was computed. net6.0 net6.0 was computed. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 was computed. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 is compatible. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 is compatible. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 is compatible. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 netcoreapp2.0 was computed. netcoreapp2.1 netcoreapp2.1 was computed. netcoreapp2.2 netcoreapp2.2 was computed. netcoreapp3.0 netcoreapp3.0 was computed. netcoreapp3.1 netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 netstandard2.0 is compatible. netstandard2.1 netstandard2.1 is compatible. |
| .NET Framework | net461 net461 was computed. net462 net462 is compatible. net463 net463 was computed. net47 net47 was computed. net471 net471 was computed. net472 net472 was computed. net48 net48 was computed. net481 net481 was computed. |
| MonoAndroid | monoandroid monoandroid was computed. |
| MonoMac | monomac monomac was computed. |
| MonoTouch | monotouch monotouch was computed. |
| Tizen | tizen40 tizen40 was computed. tizen60 tizen60 was computed. |
| Xamarin.iOS | xamarinios xamarinios was computed. |
| Xamarin.Mac | xamarinmac xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos xamarinwatchos was computed. |
Showing the top 5 NuGet packages that depend on Microsoft.Extensions.Options.DataAnnotations:
| Package | Downloads |
|---|---|
|
Microsoft.AspNetCore.App
Provides a default set of APIs for building an ASP.NET Core application. This package requires the ASP.NET Core runtime. This runtime is installed by the .NET Core SDK, or can be acquired separately using installers available at https://aka.ms/dotnet-download. |
|
|
Microsoft.AspNetCore.All
Provides a default set of APIs for building an ASP.NET Core application, and also includes API for third-party integrations with ASP.NET Core. This package requires the ASP.NET Core runtime. This runtime is installed by the .NET Core SDK, or can be acquired separately using installers available at https://aka.ms/dotnet-download. |
|
|
Umbraco.Cms.Infrastructure
Contains the infrastructure assembly needed to run Umbraco CMS. |
|
|
Umbraco.Cms.Examine.Lucene
Adds Examine searching support using Lucene to Umbraco CMS. |
|
|
Umbraco.Cms.Core
Contains the core assembly needed to run Umbraco CMS. |
Showing the top 20 popular GitHub repositories that depend on Microsoft.Extensions.Options.DataAnnotations:
| Repository | Stars |
|---|---|
|
microsoft/semantic-kernel
Integrate cutting-edge LLM technology quickly and easily into your apps
|
|
|
fullstackhero/dotnet-starter-kit
Production Grade Cloud-Ready .NET 10 Starter Kit (Web API + React Client) with Multitenancy Support, and Clean/Modular Architecture that saves roughly 200+ Development Hours! All Batteries Included.
|
|
|
umbraco/Umbraco-CMS
Umbraco is a free and open source .NET content management system helping you deliver delightful digital experiences.
|
|
|
TelegramBots/Telegram.Bot
.NET Client for Telegram Bot API
|
|
|
servicetitan/Stl.Fusion
Build real-time apps (Blazor included) with less than 1% of extra code responsible for real-time updates. Host 10-1000x faster APIs relying on transparent and nearly 100% consistent caching. We call it DREAM, or Distributed REActive Memoization, and it's here to turn real-time on!
|
|
|
Finbuckle/Finbuckle.MultiTenant
MultiTenant is an open source multi-tenancy library for modern .NET created and maintained by Finbuckle LLC.
|
|
|
lookup-foundation/RevitLookup
Interactive Revit RFA and RVT project database exploration tool to view and navigate BIM element parameters, properties and relationships.
|
|
|
bitfoundation/bitplatform
Build all of your apps using what you already know and love ❤️
|
|
|
notifo-io/notifo
Multi channel notification service for collaboration tools, e-commerce, news service and more.
|
|
|
fullstackhero/dotnet-microservices-boilerplate
The Ultimate Microservices Starter Kit for .NET Developers!
|
|
|
jeangatto/ASP.NET-Core-Clean-Architecture-CQRS-Event-Sourcing
ASP.NET Core, C#, CQRS Event Sourcing, REST API, DDD, SOLID Principles and Clean Architecture
|
|
|
planetarium/libplanet
Blockchain in C#/.NET for on-chain, decentralized gaming
|
|
|
Jcparkyn/nodexr
Graphical regular expression editor
|
|
|
NetCordDev/NetCord
A modern, lightweight, and customizable C# Discord library with Native AOT support, immutable caching, voice capabilities, and complete API coverage.
|
|
|
Nice3point/RevitTemplates
Templates for creating Revit add-ins
|
|
|
AntonioFalcaoJr/EventualShop
A state-of-the-art distributed system using Reactive DDD as uncertainty modeling, Event Storming as subdomain decomposition, Event Sourcing as an eventual persistence mechanism, CQRS, Async Projections, Microservices for individual deployable units, Event-driven Architecture for efficient integration, and Clean Architecture as domain-centric design
|
|
|
mehdihadeli/food-delivery-modular-monolith
🌭 A practical and imaginary food and grocery delivery modular monolith, built with .Net 8, Domain-Driven Design, CQRS, Vertical Slice Architecture, Event-Driven Architecture, and the latest technologies.
|
|
| dotnet/systemweb-adapters | |
|
Bryan-Cyf/SuperShortLink
这是一个基于.NET开源的短链生成及监控系统,包含了短URL的生成、短URL跳转长URL、短URL访问统计以及Web后台监控页面,可以帮助我们更容易地生成短链、监控短链!
|
|
|
loyldg/mytelegram
Self-hosted Telegram server-side API implemented in C#
|
| Version | Downloads | Last Updated |
|---|---|---|
| 11.0.0-preview.5.26302.115 | 401 | 6/9/2026 |
| 11.0.0-preview.4.26230.115 | 1,152 | 5/12/2026 |
| 11.0.0-preview.3.26207.106 | 1,071 | 4/14/2026 |
| 11.0.0-preview.2.26159.112 | 1,660 | 3/10/2026 |
| 11.0.0-preview.1.26104.118 | 1,841 | 2/10/2026 |
| 10.0.9 | 105,033 | 6/9/2026 |
| 10.0.8 | 878,185 | 5/12/2026 |
| 10.0.7 | 1,313,804 | 4/21/2026 |
| 10.0.6 | 477,414 | 4/14/2026 |
| 10.0.5 | 1,475,666 | 3/12/2026 |
| 10.0.4 | 236,070 | 3/10/2026 |
| 10.0.3 | 1,376,315 | 2/10/2026 |
| 10.0.2 | 1,700,800 | 1/13/2026 |
| 10.0.1 | 1,345,984 | 12/9/2025 |
| 9.0.17 | 2,888 | 6/9/2026 |
| 9.0.16 | 38,725 | 5/12/2026 |
| 9.0.15 | 99,703 | 4/14/2026 |
| 9.0.14 | 103,925 | 3/10/2026 |
| 9.0.13 | 128,753 | 2/10/2026 |
| 9.0.12 | 161,693 | 1/13/2026 |