什么是Microsoft.Extensions
.NET Platform Extensions是一套.Net官方的API集合,提供了一些常用的编程模式和实用工具,例如依赖项注入、日志记录、缓存、Host以及配置等等。
https://docs.microsoft.com/en-us/dotnet/api/?view=dotnet-plat-ext-6.0
.NET Platform Extensions代码已经从之前单独维护的https://github.com/dotnet/extensions转移到了https://github.com/dotnet/runtime和https://github.com/dotnet/aspnetcore中统一管理。
Microsoft.Extensions Nuget包
这些都是官方轮子,但是也是平时我们的使用首选。
Caching组
名称 | 备注 |
---|---|
Microsoft.Extensions.Caching.Memory | >= .NET 5.0; >= .NET Core App 2.0; >= .NET Standard 2.0; >= .NET Framework 4.6.1; |
Microsoft.Extensions.Caching.Abstractions | >= .NET 5.0; >= .NET Core App 2.0; >= .NET Standard 2.0; >= .NET Framework 4.6.1; |
Microsoft.Extensions.Caching.SqlServer | >= .NET 7.0; >= .NET Core App 2.0; >= .NET Standard 2.0; >= .NET Framework 4.6.2; |
Microsoft.Extensions.Caching.StackExchangeRedis | >= .NET 7.0; >= .NET Core App 2.0; >= .NET Standard 2.0; >= .NET Framework 4.6.2; |
Microsoft.Extensions.Caching.Redis | >= .NET Standard 2.0; |
Microsoft.Extensions.Caching.Cosmos | >= .NET Standard 2.0; |
Configuration组
名称 | 备注 |
---|---|
Microsoft.Extensions.Configuration | >= .NET 6.0; >= .NET Standard 2.0; >= .NET Framework 4.6.2; |
Microsoft.Extensions.Configuration.Abstractions | >= .NET 6.0; >= .NET Standard 2.0; >= .NET Framework 4.6.2; |
Microsoft.Extensions.Configuration.Binder | >= .NET 6.0; >= .NET Standard 2.0; >= .NET Framework 4.6.2; |
Microsoft.Extensions.Configuration.CommandLine | >= .NET 6.0; >= .NET Standard 2.0; >= .NET Framework 4.6.2; |
Microsoft.Extensions.Configuration.EnvironmentVariables | >= .NET 6.0; >= .NET Standard 2.0; >= .NET Framework 4.6.2 |
Microsoft.Extensions.Configuration.FileExtensions | >= .NET 6.0; >= .NET Standard 2.0; >= .NET Framework 4.6.2; |
Microsoft.Extensions.Configuration.Ini | >= .NET 6.0; >= .NET Standard 2.0; >= .NET Framework 4.6.2; |
Microsoft.Extensions.Configuration.Json | >= .NET 6.0; >= .NET Standard 2.0; >= .NET Framework 4.6.2; |
Microsoft.Extensions.Configuration.Xml | >= .NET 6.0; >= .NET Standard 2.0; >= .NET Framework 4.6.2; |
Microsoft.Extensions.Configuration.UserSecrets | >= .NET 6.0; >= .NET Standard 2.0; >= .NET Framework 4.6.2; |
Microsoft.Extensions.Configuration.KeyPerFile | >= .NET 7.0; >= .NET Standard 2.0; >= .NET Framework 4.6.2; |
Microsoft.Extensions.Configuration.AzureAppConfiguration | >= .NET Standard 2.0; |
Dependency Injection组
名称 | 备注 |
---|---|
Microsoft.Extensions.DependencyInjection | >= .NET 6.0; >= .NET Standard 2.0; >= .NET Framework 4.6.2; |
Microsoft.Extensions.DependencyInjection.Abstractions | >= .NET 6.0; >= .NET Standard 2.0; >= .NET Framework 4.6.2; |
Microsoft.Extensions.DependencyInjection.Specification.Tests | >= .NET 6.0; >= .NET Standard 2.0; >= .NET Framework 4.6.2; |
Dependency Model组
名称 | 备注 |
---|---|
Microsoft.Extensions.DependencyModel | >= .NET 6.0; >= .NET Standard 2.0; >= .NET Framework 4.6.2; |
File Providers组
名称 | 备注 |
---|---|
Microsoft.Extensions.FileProviders.Abstractions | >= .NET 6.0; >= .NET Standard 2.0; >= .NET Framework 4.6.2; |
Microsoft.Extensions.FileProviders.Physical | >= .NET 6.0; >= .NET Standard 2.0; >= .NET Framework 4.6.2; |
Microsoft.Extensions.FileProviders.Composite | >= .NET 6.0; >= .NET Standard 2.0; >= .NET Framework 4.6.2; |
Microsoft.Extensions.FileProviders.Embedded | >= .NET 7.0; >= .NET Standard 2.0; >= .NET Framework 4.6.2; |
File System Globbing组
名称 | 备注 |
---|---|
Microsoft.Extensions.FileSystemGlobbing | >= .NET 6.0; >= .NET Standard 2.0; >= .NET Framework 4.6.2; |
Hosting组
名称 | 备注 |
---|---|
Microsoft.Extensions.Hosting | >= .NET 6.0; >= .NET Standard 2.0; >= .NET Framework 4.6.2; |
Microsoft.Extensions.Hosting.Abstractions | >= .NET 6.0; >= .NET Standard 2.0; >= .NET Framework 4.6.2; |
Microsoft.Extensions.Hosting.WindowsServices | >= .NET 6.0; >= .NET Standard 2.0; >= .NET Framework 4.6.2; |
Microsoft.Extensions.Hosting.Systemd | >= .NET 6.0; >= .NET Standard 2.1; |
Http Client Factory组
名称 | 备注 |
---|---|
Microsoft.Extensions.Http | >= .NET 6.0; >= .NET Standard 2.0; >= .NET Framework 4.6.2; |
Microsoft.Extensions.Http.Polly | >= .NET Standard 2.0; |
Logging组
名称 | 备注 |
---|---|
Microsoft.Extensions.Logging | >= .NET 6.0; >= .NET Standard 2.0; >= .NET Framework 4.6.2; |
Microsoft.Extensions.Logging.Abstractions | >= .NET 6.0; >= .NET Standard 2.0; >= .NET Framework 4.6.2; |
Microsoft.Extensions.Logging.Configuration | >= .NET 6.0; >= .NET Standard 2.0; >= .NET Framework 4.6.2; |
Microsoft.Extensions.Logging.Console | >= .NET 6.0; >= .NET Standard 2.0; >= .NET Framework 4.6.2; |
Microsoft.Extensions.Logging.Debug | >= .NET 6.0; >= .NET Standard 2.0; >= .NET Framework 4.6.2; |
Microsoft.Extensions.Logging.EventSource | >= .NET 6.0; >= .NET Standard 2.0; >= .NET Framework 4.6.2; |
Microsoft.Extensions.Logging.EventLog | >= .NET 6.0; >= .NET Standard 2.0; >= .NET Framework 4.6.2; |
Microsoft.Extensions.Logging.TraceSource | >= .NET 6.0; >= .NET Standard 2.0; >= .NET Framework 4.6.2; |
Microsoft.Extensions.Logging.ApplicationInsights | >= .NET Standard 2.0; |
Microsoft.Extensions.Logging.AzureAppServices | >= .NET 7.0; >= .NET Standard 2.0; >= .NET Framework 4.6.2; |
Options组
名称 | 备注 |
---|---|
Microsoft.Extensions.Options | >= .NET 6.0; >= .NET Standard 2.0; >= .NET Framework 4.6.2; |
Microsoft.Extensions.Options.ConfigurationExtensions | >= .NET 6.0; >= .NET Standard 2.0; >= .NET Framework 4.6.2; |
Microsoft.Extensions.Options.DataAnnotations | >= .NET 6.0; >= .NET Standard 2.0; >= .NET Framework 4.6.2; |
Primitives组
名称 | 备注 |
---|---|
Microsoft.Extensions.Primitives | >= .NET 6.0; >= .NET Standard 2.0; >= .NET Framework 4.6.2; |
Diagnostics组
名称 | 备注 |
---|---|
Microsoft.Extensions.Diagnostics.HealthChecks | >= .NET 7.0; >= .NET Standard 2.0; >= .NET Framework 4.6.2; |
Microsoft.Extensions.Diagnostics.HealthChecks.Abstractions | >= .NET 7.0; >= .NET Standard 2.0; >= .NET Framework 4.6.2; |
Microsoft.Extensions.Diagnostics.HealthChecks.EntityFrameworkCore | >= .NET 7.0; |
JSInterop组
名称 | 备注 |
---|---|
Microsoft.JSInterop | >= .NET 7.0; |
Microsoft.JSInterop.WebAssembly | >= .NET 7.0; |
Localization组
名称 | 备注 |
---|---|
Microsoft.Extensions.Localization | >= .NET 7.0; >= .NET Standard 2.0; >= .NET Framework 4.6.2; |
Microsoft.Extensions.Localization.Abstractions | >= .NET 7.0; >= .NET Standard 2.0; >= .NET Framework 4.6.2; |
Object Pool组
名称 | 备注 |
---|---|
Microsoft.Extensions.ObjectPool | >= .NET 7.0; >= .NET Standard 2.0; >= .NET Framework 4.6.2; |
WebEncoders组
名称 | 备注 |
---|---|
Microsoft.Extensions.WebEncoders | >= .NET 7.0; >= .NET Standard 2.0; >= .NET Framework 4.6.2; |
Identity组
名称 | 备注 |
---|---|
Microsoft.Extensions.Identity.Core | >= .NET 7.0; >= .NET Standard 2.0; >= .NET Framework 4.6.2; |
Microsoft.Extensions.Identity.Stores | >= .NET 7.0; >= .NET Standard 2.0; >= .NET Framework 4.6.2 |
Azure组
名称 | 备注 |
---|---|
Microsoft.Extensions.Azure | >= .NET Standard 2.0; |
Features组
名称 | 备注 |
---|---|
Microsoft.Extensions.Features | >= .NET 7.0; >= .NET Standard 2.0; >= .NET Framework 4.6.2; |
Machine Learning组
名称 | 备注 |
---|---|
Microsoft.Extensions.ML | >= .NET Standard 2.0; |
过期组
Microsoft.System Nuget包
System组
名称 | 备注 |
---|---|
System.Threading.Tasks.Extensions | >= .NET Core 2.1; >= .NET Standard 1.0; >= .NET Framework 4.6.1; |
System.Diagnostics.DiagnosticSource | >= .NET 5.0; >= .NETStandard 2.0; >= .NETFramework 4.6.1; |
System.Buffers | >= .NET Core 2.0; >= .NET Standard 1.1; >= .NET Framework 4.5; |
System.Memory | >= .NET Core 2.1; >= .NET Standard 1.1; >= .NET Framework 4.6.1; |