Microsoft.Extensions.Options.ConfigurationExtensions
                               
                            
                                9.0.10
                            
                        
                            
                                
                                
                                    Prefix Reserved
                                
                            
                    See the version list below for details.
dotnet add package Microsoft.Extensions.Options.ConfigurationExtensions --version 9.0.10
NuGet\Install-Package Microsoft.Extensions.Options.ConfigurationExtensions -Version 9.0.10
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="9.0.10" />
<PackageVersion Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="9.0.10" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" />
paket add Microsoft.Extensions.Options.ConfigurationExtensions --version 9.0.10
#r "nuget: Microsoft.Extensions.Options.ConfigurationExtensions, 9.0.10"
#:package Microsoft.Extensions.Options.ConfigurationExtensions@9.0.10
#addin nuget:?package=Microsoft.Extensions.Options.ConfigurationExtensions&version=9.0.10
#tool nuget:?package=Microsoft.Extensions.Options.ConfigurationExtensions&version=9.0.10
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:
- ConfigurationChangeTokenSource
- OptionsBuilderConfigurationExtensions
- OptionsConfigurationServiceCollectionExtensions
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 was computed. 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 (>= 9.0.10)
- Microsoft.Extensions.Configuration.Binder (>= 9.0.10)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 9.0.10)
- Microsoft.Extensions.Options (>= 9.0.10)
- Microsoft.Extensions.Primitives (>= 9.0.10)
 
- 
                                                    .NETStandard 2.0- Microsoft.Extensions.Configuration.Abstractions (>= 9.0.10)
- Microsoft.Extensions.Configuration.Binder (>= 9.0.10)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 9.0.10)
- Microsoft.Extensions.Options (>= 9.0.10)
- Microsoft.Extensions.Primitives (>= 9.0.10)
 
- 
                                                    net8.0- Microsoft.Extensions.Configuration.Abstractions (>= 9.0.10)
- Microsoft.Extensions.Configuration.Binder (>= 9.0.10)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 9.0.10)
- Microsoft.Extensions.Options (>= 9.0.10)
- Microsoft.Extensions.Primitives (>= 9.0.10)
 
- 
                                                    net9.0- Microsoft.Extensions.Configuration.Abstractions (>= 9.0.10)
- Microsoft.Extensions.Configuration.Binder (>= 9.0.10)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 9.0.10)
- Microsoft.Extensions.Options (>= 9.0.10)
- Microsoft.Extensions.Primitives (>= 9.0.10)
 
NuGet packages (4.7K)
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.Resilience Extensions to the Polly libraries to enrich telemetry with metadata and exception summaries. | 
GitHub repositories (297)
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 9
                                                         | |
| 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+.
                                                         | |
| 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.
                                                         | |
| 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 8.0。已支持微信公众号、小程序、小游戏、微信支付、企业微信/企业号、开放平台、JSSDK、微信周边等全平台。 WeChat SDK for C#.
                                                         | |
| ThreeMammals/Ocelot 
                                                            .NET API Gateway
                                                         | |
| RayWangQvQ/BiliBiliToolPro 
                                                            B 站(bilibili)自动任务工具,支持docker、青龙、k8s等多种部署方式。敏感肌也能用。
                                                         | |
| elsa-workflows/elsa-core 
                                                            A .NET workflows library
                                                         | |
| 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
                                                         | |
| 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.
                                                         | |
| dotnetcore/BootstrapBlazor 
                                                            Bootstrap Blazor is an enterprise-level UI component library based on Bootstrap and Blazor.
                                                         | |
| TelegramBots/Telegram.Bot 
                                                            .NET Client for Telegram Bot API
                                                         | |
| fluentmigrator/fluentmigrator 
                                                            Fluent migrations framework for .NET
                                                         | 
| Version | Downloads | Last Updated | |
|---|---|---|---|
| 10.0.0-rc.2.25502.107 | 77,733 | 10/14/2025 | |
| 10.0.0-rc.1.25451.107 | 183,197 | 9/9/2025 | |
| 10.0.0-preview.7.25380.108 | 67,889 | 8/12/2025 | |
| 10.0.0-preview.6.25358.103 | 60,600 | 7/15/2025 | |
| 10.0.0-preview.5.25277.114 | 76,226 | 6/6/2025 | |
| 10.0.0-preview.4.25258.110 | 57,356 | 5/12/2025 | |
| 10.0.0-preview.3.25171.5 | 70,430 | 4/10/2025 | |
| 10.0.0-preview.2.25163.2 | 52,124 | 3/18/2025 | |
| 10.0.0-preview.1.25080.5 | 142,629 | 2/25/2025 | |
| 9.0.10 | 1,622,780 | 10/14/2025 | |
| 9.0.9 | 6,714,898 | 9/9/2025 | |
| 9.0.8 | 8,600,492 | 8/4/2025 | |
| 9.0.7 | 7,733,892 | 7/8/2025 | |
| 9.0.6 | 8,998,690 | 6/10/2025 | |
| 9.0.5 | 11,272,446 | 5/13/2025 | |
| 9.0.4 | 14,823,359 | 4/8/2025 | |
| 9.0.3 | 11,859,185 | 3/11/2025 | |
| 9.0.2 | 13,949,116 | 2/11/2025 | |
| 9.0.1 | 14,544,380 | 1/14/2025 | |
| 9.0.0 | 71,444,449 | 11/12/2024 | |
| 9.0.0-rc.2.24473.5 | 599,256 | 10/8/2024 | |
| 9.0.0-rc.1.24431.7 | 378,934 | 9/10/2024 | |
| 9.0.0-preview.7.24405.7 | 127,324 | 8/13/2024 | |
| 9.0.0-preview.6.24327.7 | 232,886 | 7/9/2024 | |
| 9.0.0-preview.5.24306.7 | 117,097 | 6/11/2024 | |
| 9.0.0-preview.4.24266.19 | 85,644 | 5/21/2024 | |
| 9.0.0-preview.3.24172.9 | 202,569 | 4/11/2024 | |
| 9.0.0-preview.2.24128.5 | 97,430 | 3/12/2024 | |
| 9.0.0-preview.1.24080.9 | 107,570 | 2/13/2024 | |
| 8.0.0 | 372,689,100 | 11/14/2023 | |
| 8.0.0-rc.2.23479.6 | 1,726,821 | 10/10/2023 | |
| 8.0.0-rc.1.23419.4 | 624,142 | 9/12/2023 | |
| 8.0.0-preview.7.23375.6 | 647,819 | 8/8/2023 | |
| 8.0.0-preview.6.23329.7 | 110,489 | 7/11/2023 | |
| 8.0.0-preview.5.23280.8 | 79,301 | 6/13/2023 | |
| 8.0.0-preview.4.23259.5 | 323,793 | 5/16/2023 | |
| 8.0.0-preview.3.23174.8 | 127,620 | 4/11/2023 | |
| 8.0.0-preview.2.23128.3 | 58,807 | 3/14/2023 | |
| 8.0.0-preview.1.23110.8 | 109,482 | 2/21/2023 | |
| 7.0.0 | 137,026,450 | 11/7/2022 | |
| 7.0.0-rc.2.22472.3 | 193,382 | 10/11/2022 | |
| 7.0.0-rc.1.22426.10 | 95,834 | 9/14/2022 | |
| 7.0.0-preview.7.22375.6 | 69,136 | 8/9/2022 | |
| 7.0.0-preview.6.22324.4 | 66,754 | 7/12/2022 | |
| 7.0.0-preview.5.22301.12 | 51,953 | 6/14/2022 | |
| 7.0.0-preview.4.22229.4 | 64,251 | 5/10/2022 | |
| 7.0.0-preview.3.22175.4 | 58,483 | 4/13/2022 | |
| 7.0.0-preview.2.22152.2 | 17,264 | 3/14/2022 | |
| 7.0.0-preview.1.22076.8 | 33,143 | 2/17/2022 | |
| 6.0.1 | 1,096,732 | 11/12/2024 | |
| 6.0.0 | 337,547,069 | 11/8/2021 | |
| 6.0.0-rc.2.21480.5 | 421,406 | 10/12/2021 | |
| 6.0.0-rc.1.21451.13 | 299,190 | 9/14/2021 | |
| 6.0.0-preview.7.21377.19 | 161,552 | 8/10/2021 | |
| 6.0.0-preview.6.21352.12 | 93,377 | 7/14/2021 | |
| 6.0.0-preview.5.21301.5 | 41,740 | 6/15/2021 | |
| 6.0.0-preview.4.21253.7 | 38,783 | 5/24/2021 | |
| 6.0.0-preview.3.21201.4 | 61,847 | 4/8/2021 | |
| 6.0.0-preview.2.21154.6 | 86,521 | 3/11/2021 | |
| 6.0.0-preview.1.21102.12 | 73,996 | 2/12/2021 | |
| 5.0.0 | 207,557,786 | 11/9/2020 | |
| 5.0.0-rc.2.20475.5 | 147,811 | 10/13/2020 | |
| 5.0.0-rc.1.20451.14 | 272,603 | 9/14/2020 | |
| 5.0.0-preview.8.20407.11 | 367,713 | 8/25/2020 | |
| 5.0.0-preview.7.20364.11 | 47,541 | 7/21/2020 | |
| 5.0.0-preview.6.20305.6 | 45,652 | 6/25/2020 | |
| 5.0.0-preview.5.20278.1 | 23,889 | 6/10/2020 | |
| 5.0.0-preview.4.20251.6 | 37,089 | 5/18/2020 | |
| 5.0.0-preview.3.20215.2 | 34,086 | 4/23/2020 | |
| 5.0.0-preview.2.20160.3 | 55,048 | 4/2/2020 | |
| 5.0.0-preview.1.20120.4 | 33,497 | 3/16/2020 | |
| 3.1.32 | 8,660,281 | 12/13/2022 | |
| 3.1.31 | 1,301,050 | 11/8/2022 | |
| 3.1.30 | 1,740,762 | 10/11/2022 | |
| 3.1.29 | 779,136 | 9/13/2022 | |
| 3.1.28 | 1,302,836 | 8/9/2022 | |
| 3.1.27 | 1,268,181 | 7/12/2022 | |
| 3.1.26 | 728,373 | 6/14/2022 | |
| 3.1.25 | 1,386,602 | 5/10/2022 | |
| 3.1.24 | 805,429 | 4/11/2022 | |
| 3.1.23 | 1,994,085 | 3/8/2022 | |
| 3.1.22 | 14,658,923 | 12/14/2021 | |
| 3.1.21 | 3,886,501 | 11/7/2021 | |
| 3.1.20 | 1,608,215 | 10/11/2021 | |
| 3.1.19 | 1,737,477 | 9/14/2021 | |
| 3.1.18 | 4,070,132 | 8/10/2021 | |
| 3.1.17 | 2,869,612 | 7/13/2021 | |
| 3.1.16 | 2,890,141 | 6/8/2021 | |
| 3.1.15 | 4,573,327 | 5/11/2021 | |
| 3.1.14 | 10,401,405 | 4/6/2021 | |
| 3.1.13 | 6,854,153 | 3/9/2021 | |
| 3.1.12 | 4,648,540 | 2/9/2021 | |
| 3.1.11 | 6,070,212 | 1/12/2021 | |
| 3.1.10 | 12,152,132 | 11/9/2020 | |
| 3.1.9 | 13,594,839 | 10/13/2020 | |
| 3.1.8 | 18,502,449 | 9/8/2020 | |
| 3.1.7 | 11,150,761 | 8/11/2020 | |
| 3.1.6 | 20,414,361 | 7/14/2020 | |
| 3.1.5 | 19,763,268 | 6/9/2020 | |
| 3.1.4 | 13,042,996 | 5/12/2020 | |
| 3.1.3 | 20,976,859 | 3/24/2020 | |
| 3.1.2 | 19,302,565 | 2/18/2020 | |
| 3.1.1 | 16,222,734 | 1/14/2020 | |
| 3.1.0 | 127,054,565 | 12/3/2019 | |
| 3.1.0-preview3.19553.2 | 59,385 | 11/13/2019 | |
| 3.1.0-preview2.19525.4 | 16,234 | 11/1/2019 | |
| 3.1.0-preview1.19506.1 | 19,832 | 10/15/2019 | |
| 3.0.3 | 716,164 | 2/18/2020 | |
| 3.0.2 | 849,894 | 1/14/2020 | |
| 3.0.1 | 2,380,657 | 11/18/2019 | |
| 3.0.0 | 37,004,674 | 9/23/2019 | |
| 3.0.0-rc1.19456.10 | 35,942 | 9/16/2019 | |
| 3.0.0-preview9.19423.4 | 140,090 | 9/4/2019 | |
| 3.0.0-preview8.19405.4 | 175,285 | 8/13/2019 | |
| 3.0.0-preview7.19362.4 | 81,684 | 7/23/2019 | |
| 3.0.0-preview6.19304.6 | 157,565 | 6/12/2019 | |
| 3.0.0-preview5.19227.9 | 170,168 | 5/6/2019 | |
| 3.0.0-preview4.19216.2 | 24,683 | 4/18/2019 | |
| 3.0.0-preview3.19153.1 | 163,825 | 3/6/2019 | |
| 3.0.0-preview.19074.2 | 99,271 | 1/29/2019 | |
| 3.0.0-preview.18572.1 | 11,416 | 12/4/2018 | |
| 2.2.0 | 98,095,866 | 12/3/2018 | |
| 2.2.0-preview3-35497 | 143,428 | 10/17/2018 | |
| 2.2.0-preview2-35157 | 66,277 | 9/12/2018 | |
| 2.2.0-preview1-35029 | 35,512 | 8/22/2018 | |
| 2.1.1 | 78,585,408 | 6/18/2018 | |
| 2.1.0 | 231,553,109 | 5/29/2018 | |
| 2.1.0-rc1-final | 79,231 | 5/6/2018 | |
| 2.1.0-preview2-final | 70,704 | 4/10/2018 | |
| 2.1.0-preview1-final | 163,568 | 2/26/2018 | |
| 2.0.2 | 6,532,503 | 5/7/2018 | |
| 2.0.1 | 10,787,822 | 3/13/2018 | |
| 2.0.0 | 390,418,500 | 8/11/2017 | |
| 2.0.0-preview2-final | 129,606 | 6/28/2017 | |
| 2.0.0-preview1-final | 40,888 | 5/10/2017 | |
| 1.1.2 | 9,021,409 | 5/9/2017 | |
| 1.1.1 | 2,948,704 | 3/6/2017 | |
| 1.1.0 | 2,580,478 | 11/16/2016 | |
| 1.1.0-preview1-final | 16,208 | 10/24/2016 | |
| 1.0.2 | 790,862 | 3/6/2017 | |
| 1.0.1 | 325,992 | 12/12/2016 | |
| 1.0.0 | 2,264,527 | 6/27/2016 | |
| 1.0.0-rc2-final | 24,742 | 5/16/2016 |