Microsoft.Extensions.Options.ConfigurationExtensions
10.0.3
Prefix Reserved
See the version list below for details.
dotnet add package Microsoft.Extensions.Options.ConfigurationExtensions --version 10.0.3
NuGet\Install-Package Microsoft.Extensions.Options.ConfigurationExtensions -Version 10.0.3
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="10.0.3" />
<PackageVersion Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="10.0.3" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" />
paket add Microsoft.Extensions.Options.ConfigurationExtensions --version 10.0.3
#r "nuget: Microsoft.Extensions.Options.ConfigurationExtensions, 10.0.3"
#:package Microsoft.Extensions.Options.ConfigurationExtensions@10.0.3
#addin nuget:?package=Microsoft.Extensions.Options.ConfigurationExtensions&version=10.0.3
#tool nuget:?package=Microsoft.Extensions.Options.ConfigurationExtensions&version=10.0.3
About
Microsoft.Extensions.Options.ConfigurationExtensions provides additional configuration-specific functionality related to Options.
Key Features
- Extension methods for OptionsBuilder for configuration binding
- Extension methods for IServiceCollection for Options configuration
- ConfigurationChangeTokenSource<TOptions> for monitoring configuration changes
How to Use
Options Configuration binding
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;
class Program
{
// appsettings.json contents:
// {
// "MyOptions": {
// "Setting1": "Value1",
// "Setting2": "Value2"
// }
// }
static void Main(string[] args)
{
IConfiguration configuration = new ConfigurationBuilder()
.SetBasePath(Environment.CurrentDirectory)
.AddJsonFile("appsettings.json")
.Build();
IServiceCollection services = new ServiceCollection();
// Bind the configuration to MyOptions
services.Configure<MyOptions>(configuration.GetSection("MyOptions"));
IServiceProvider serviceProvider = services.BuildServiceProvider();
// Retrieve MyOptions using dependency injection
var myOptions = serviceProvider.GetRequiredService<IOptions<MyOptions>>().Value;
// Access the bound configuration values
Console.WriteLine($"Setting1: {myOptions.Setting1}");
Console.WriteLine($"Setting2: {myOptions.Setting2}");
}
}
public class MyOptions
{
public string Setting1 { get; set; }
public string Setting2 { get; set; }
}
Monitoring options configuration changes
// Assume we have a class that represents some options
public class MyOptions
{
public string Name { get; set; }
public int Age { get; set; }
}
// appsettings.json contents:
// {
// "MyOptions": {
// "Name": "Alice",
// "Age": 25
// }
// }
// Assume we have a configuration object that contains some settings
var config = new ConfigurationBuilder()
.AddJsonFile("appsettings.json")
.Build();
// We can use the ConfigurationChangeTokenSource to create a change token source for the options
var changeTokenSource = new ConfigurationChangeTokenSource<MyOptions>(config.GetSection("MyOptions"));
// We can register the change token source with the options monitor
services.AddOptions<MyOptions>()
.Configure(options =>
{
// Configure the options with the configuration values
config.GetSection("MyOptions").Bind(options);
})
.AddChangeTokenSource(changeTokenSource);
// Now we can inject the options monitor into any class that needs them
public class MyClass
{
private readonly IOptionsMonitor<MyOptions> _optionsMonitor;
public MyClass(IOptionsMonitor<MyOptions> optionsMonitor)
{
_optionsMonitor = optionsMonitor;
}
public void DoSomething()
{
// Can access the current options value like this
var options = _optionsMonitor.CurrentValue;
var name = options.Name;
var age = options.Age;
// Do something with name and age
// Can also register a callback to be notified when the options change
_optionsMonitor.OnChange(newOptions =>
{
// Do something when the options change
});
}
}
Main Types
The main types provided by this library are:
ConfigurationChangeTokenSourceOptionsBuilderConfigurationExtensionsOptionsConfigurationServiceCollectionExtensions
Additional Documentation
Related Packages
- Microsoft.Extensions.Options
- Microsoft.Extensions.Configuration
- Microsoft.Extensions.DependencyInjection
Feedback & Contributing
Microsoft.Extensions.Options.ConfigurationExtensions 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 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. 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 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. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 is compatible. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETFramework 4.6.2
- Microsoft.Extensions.Configuration.Abstractions (>= 10.0.3)
- Microsoft.Extensions.Configuration.Binder (>= 10.0.3)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.3)
- Microsoft.Extensions.Options (>= 10.0.3)
- Microsoft.Extensions.Primitives (>= 10.0.3)
-
.NETStandard 2.0
- Microsoft.Extensions.Configuration.Abstractions (>= 10.0.3)
- Microsoft.Extensions.Configuration.Binder (>= 10.0.3)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.3)
- Microsoft.Extensions.Options (>= 10.0.3)
- Microsoft.Extensions.Primitives (>= 10.0.3)
-
net10.0
- Microsoft.Extensions.Configuration.Abstractions (>= 10.0.3)
- Microsoft.Extensions.Configuration.Binder (>= 10.0.3)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.3)
- Microsoft.Extensions.Options (>= 10.0.3)
- Microsoft.Extensions.Primitives (>= 10.0.3)
-
net8.0
- Microsoft.Extensions.Configuration.Abstractions (>= 10.0.3)
- Microsoft.Extensions.Configuration.Binder (>= 10.0.3)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.3)
- Microsoft.Extensions.Options (>= 10.0.3)
- Microsoft.Extensions.Primitives (>= 10.0.3)
-
net9.0
- Microsoft.Extensions.Configuration.Abstractions (>= 10.0.3)
- Microsoft.Extensions.Configuration.Binder (>= 10.0.3)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.3)
- Microsoft.Extensions.Options (>= 10.0.3)
- Microsoft.Extensions.Primitives (>= 10.0.3)
NuGet packages (5.1K)
Showing the top 5 NuGet packages that depend on Microsoft.Extensions.Options.ConfigurationExtensions:
| Package | Downloads |
|---|---|
|
Microsoft.Extensions.Logging.Configuration
Configuration support for Microsoft.Extensions.Logging. |
|
|
Microsoft.Extensions.Diagnostics
This package includes the default implementation of IMeterFactory and additional extension methods to easily register it with the Dependency Injection framework. |
|
|
Microsoft.Identity.Web.TokenAcquisition
Implementation for higher level API for confidential client applications (ASP.NET Core and SDK/.NET). |
|
|
Microsoft.Extensions.AmbientMetadata.Application
Runtime information provider for application-level ambient metadata. |
|
|
Microsoft.Extensions.Http.Diagnostics
Telemetry support for HTTP Client. |
GitHub repositories (302)
Showing the top 20 popular GitHub repositories that depend on Microsoft.Extensions.Options.ConfigurationExtensions:
| Repository | Stars |
|---|---|
|
ardalis/CleanArchitecture
Clean Architecture Solution Template: A proven Clean Architecture Template for ASP.NET Core 10
|
|
|
abpframework/abp
Open-source web application framework for ASP.NET Core! Offers an opinionated architecture to build enterprise software solutions with best practices on top of the .NET. Provides the fundamental infrastructure, cross-cutting-concern implementations, startup templates, application modules, UI themes, tooling and documentation.
|
|
|
App-vNext/Polly
Polly is a .NET resilience and transient-fault-handling library that allows developers to express policies such as Retry, Circuit Breaker, Timeout, Bulkhead Isolation, and Fallback in a fluent and thread-safe manner. From version 6.0.1, Polly targets .NET Standard 1.1 and 2.0+.
|
|
|
dotnet/AspNetCore.Docs
Documentation for ASP.NET Core
|
|
|
chocolatey/choco
Chocolatey - the package manager for Windows
|
|
|
dotnet/orleans
Cloud Native application framework for .NET
|
|
|
JeffreySu/WeiXinMPSDK
微信全平台 .NET SDK, Senparc.Weixin for C#,支持 .NET Framework 及 .NET Core、.NET 10.0。已支持微信公众号、小程序、小游戏、微信支付、企业微信/企业号、开放平台、JSSDK、微信周边等全平台。 WeChat SDK for C#.
|
|
|
ThreeMammals/Ocelot
.NET API Gateway
|
|
|
RayWangQvQ/BiliBiliToolPro
B 站(bilibili)自动任务工具,支持docker、青龙、k8s等多种部署方式。敏感肌也能用。
|
|
|
elsa-workflows/elsa-core
The Workflow Engine for .NET
|
|
|
LykosAI/StabilityMatrix
Multi-Platform Package Manager for Stable Diffusion
|
|
|
ant-design-blazor/ant-design-blazor
🌈A rich set of enterprise-class UI components based on Ant Design and Blazor.
|
|
|
kurrent-io/KurrentDB
KurrentDB is a database that's engineered for modern software applications and event-driven architectures. Its event-native design simplifies data modeling and preserves data integrity while the integrated streaming engine solves distributed messaging challenges and ensures data consistency.
|
|
|
anjoy8/Blog.Core
💖 ASP.NET Core 8.0 全家桶教程,前后端分离后端接口,vue教程姊妹篇,官方文档:
|
|
|
umbraco/Umbraco-CMS
Umbraco is a free and open source .NET content management system helping you deliver delightful digital experiences.
|
|
|
opserver/Opserver
Stack Exchange's Monitoring System
|
|
|
dotnetcore/BootstrapBlazor
Bootstrap Blazor is an enterprise-level UI component library based on Bootstrap and Blazor.
|
|
|
kerryjiang/SuperSocket
SuperSocket is a high-performance, extensible socket server application framework for .NET. It provides a robust architecture for building custom network communication applications with support for multiple protocols including TCP, UDP, and WebSocket.
|
|
|
TelegramBots/Telegram.Bot
.NET Client for Telegram Bot API
|
|
|
fluentmigrator/fluentmigrator
Fluent migrations framework for .NET
|
| Version | Downloads | Last Updated |
|---|---|---|
| 11.0.0-preview.1.26104.118 | 1,474 | 2/10/2026 |
| 10.0.3 | 266,381 | 2/10/2026 |
| 10.0.2 | 4,778,213 | 1/13/2026 |
| 10.0.1 | 6,320,475 | 12/9/2025 |
| 10.0.0 | 14,026,581 | 11/11/2025 |
| 10.0.0-rc.2.25502.107 | 250,821 | 10/14/2025 |
| 10.0.0-rc.1.25451.107 | 294,316 | 9/9/2025 |
| 10.0.0-preview.7.25380.108 | 95,767 | 8/12/2025 |
| 10.0.0-preview.6.25358.103 | 94,602 | 7/15/2025 |
| 10.0.0-preview.5.25277.114 | 101,411 | 6/6/2025 |
| 10.0.0-preview.4.25258.110 | 83,230 | 5/12/2025 |
| 9.0.13 | 39,533 | 2/10/2026 |
| 9.0.12 | 827,247 | 1/13/2026 |
| 9.0.11 | 4,567,027 | 11/11/2025 |
| 9.0.10 | 11,493,692 | 10/14/2025 |
| 9.0.9 | 14,503,280 | 9/9/2025 |
| 9.0.8 | 14,576,055 | 8/4/2025 |
| 9.0.7 | 11,874,530 | 7/8/2025 |
| 9.0.6 | 13,102,009 | 6/10/2025 |
| 9.0.5 | 15,908,311 | 5/13/2025 |