Azrng.ConsoleApp.DependencyInjection
1.2.0
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package Azrng.ConsoleApp.DependencyInjection --version 1.2.0
NuGet\Install-Package Azrng.ConsoleApp.DependencyInjection -Version 1.2.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Azrng.ConsoleApp.DependencyInjection" Version="1.2.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Azrng.ConsoleApp.DependencyInjection" Version="1.2.0" />
<PackageReference Include="Azrng.ConsoleApp.DependencyInjection" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Azrng.ConsoleApp.DependencyInjection --version 1.2.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Azrng.ConsoleApp.DependencyInjection, 1.2.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Azrng.ConsoleApp.DependencyInjection@1.2.0
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Azrng.ConsoleApp.DependencyInjection&version=1.2.0
#tool nuget:?package=Azrng.ConsoleApp.DependencyInjection&version=1.2.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Azrng.ConsoleApp.DependencyInjection
控制台依赖注入扩展
- 支持读取appsettings.json配置文件
- 默认使用了Serilog日志输出
使用方法
var builder = new ConsoleAppServer(args);
// 注入自定义配置
// builder.Services.AddHttpClient();
await using var sp = builder.Build<UrlSortService>();
await sp.RunAsync();
Console.Read();
这里的示例类UrlSortService类需要继承自IServiceStart,然后实现方法即可
版本更新记录
- 1.2.0
- 支持将默认ILogger日志输出到本地文件
- 1.1.0
- 更新依赖项
- 1.0.1
- 读取环境变量需增加变量前缀:ASPNETCORE_
- 1.1.0-beta1
- 测试进一步缩小打包文件的大小
- 1.0.0
- 基础控制台依赖注入开发
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net8.0
- Azrng.Core (>= 1.7.0)
- Microsoft.Extensions.Hosting (>= 8.0.0)
- Serilog.Extensions.Hosting (>= 8.0.0)
- Serilog.Settings.Configuration (>= 8.0.0)
- Serilog.Sinks.Console (>= 6.0.0)
-
net9.0
- Azrng.Core (>= 1.7.0)
- Microsoft.Extensions.Hosting (>= 9.0.0)
- Serilog.Extensions.Hosting (>= 9.0.0)
- Serilog.Settings.Configuration (>= 9.0.0)
- Serilog.Sinks.Console (>= 6.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.3.4 | 80 | 3/1/2026 |
| 1.3.3 | 85 | 2/27/2026 |
| 1.3.2 | 596 | 12/1/2025 |
| 1.3.2-beta3 | 414 | 11/19/2025 |
| 1.3.2-beta2 | 289 | 11/12/2025 |
| 1.3.2-beta1 | 162 | 11/6/2025 |
| 1.3.1 | 199 | 7/7/2025 |
| 1.3.0 | 204 | 7/1/2025 |
| 1.2.0 | 186 | 5/9/2025 |
| 1.1.0 | 173 | 3/21/2025 |
| 1.1.0-beta1 | 147 | 2/18/2025 |
| 1.0.1 | 173 | 2/23/2025 |
| 1.0.0 | 171 | 2/17/2025 |