Neolution.DotNet.Console
3.0.0-rc.0
Prefix Reserved
See the version list below for details.
dotnet add package Neolution.DotNet.Console --version 3.0.0-rc.0
NuGet\Install-Package Neolution.DotNet.Console -Version 3.0.0-rc.0
<PackageReference Include="Neolution.DotNet.Console" Version="3.0.0-rc.0" />
paket add Neolution.DotNet.Console --version 3.0.0-rc.0
#r "nuget: Neolution.DotNet.Console, 3.0.0-rc.0"
// Install Neolution.DotNet.Console as a Cake Addin #addin nuget:?package=Neolution.DotNet.Console&version=3.0.0-rc.0&prerelease // Install Neolution.DotNet.Console as a Cake Tool #tool nuget:?package=Neolution.DotNet.Console&version=3.0.0-rc.0&prerelease
Introduction
Neolution.DotNet.Console is a versatile package designed as a launchpad for .NET console applications. It comes equipped with a built-in dependency injection setup, mirroring the functionality found in ASP.NET Core applications, thus providing a seamless and intuitive user experience.
Getting Started
To help you kickstart your console application, we've provided a a sample application that should demonstrate the basic usage of this package.
Guides
Migrate from V2 to V3
In .NET 6 the hosting model for ASP.NET Core applications was changed, we adjusted to that to fulfill the primary goal of this package: to provide a seamless and intuitive user experience. This introduces breaking changes that are explained below.
Removed ICompositionRoot
interface and UseCompositionRoot
extension method
The builder returned from calling DotNetConsole.CreateDefaultBuilder(args)
now has a Services
property that can be used to register services. Like in ASP.NET, this can now be done directly in Program.cs
.
public static async Task Main(string[] args)
{
var builder = DotNetConsole.CreateDefaultBuilder(args);
// Register your services here...
builder.Services.AddHttpClient();
builder.Services.AddScoped<IScopedService, ServiceA>();
builder.Services.AddSingleton<ISingletonService, ServiceB>();
await builder.Build().RunAsync();
}
Async by default
All commands are now async by default. Use the new IDotNetConsoleCommand
interface instead of IConsoleAppCommand
and IAsyncConsoleAppCommand
.
Service registration validation
The service registrations are now validated when app.Build()
is called. This means that the application will not start if not all services that are registered (even if not used during runtime) can be created by the DI container or when there are scope/lifetime issues with the services.
Migrate from V1 to V2
V2 introduces breaking changes from V1, primarily because it upgrades NLog to Version 5. For a detailed review of these changes, please refer to the official NLog release notes.
Removed Logging
section in appsettings.json
NLog decided to deprecate Microsoft's Logging
section in the appsettings.json starting with V5. In accordance of that decision we've also transitioned to only using NLog rules for filtering logging output. Although these rules might be a bit more complex, they offer greater flexibility and control.
To get acquainted with these rules and learn how to migrate your current configuration, check out the NLog documentation on logging rules. There's also a guide on the new finalMinLevel attribute that you might find helpful.
Removed default logging targets
AWS Logger: The AWS Logger, previously used for logging to CloudWatch, has been removed due to decreased usage. If you still need it, don't worry, you can easily download it separately. The configuration remains the same.
DatabaseTarget: The DatabaseTarget is no longer part of the NLog NuGet package. If you use this target, you'll need to download it separately to ensure its continued functionality.
There are additional targets that have been transitioned into separate packages. Please review this list to determine if any targets you use are affected.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. 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 was computed. 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. |
-
net6.0
- CommandLineParser (>= 2.9.1)
- Microsoft.Extensions.Configuration.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Configuration.CommandLine (>= 8.0.0)
- Microsoft.Extensions.Configuration.EnvironmentVariables (>= 8.0.0)
- Microsoft.Extensions.Configuration.Json (>= 8.0.0)
- Microsoft.Extensions.Configuration.UserSecrets (>= 8.0.0)
- Microsoft.Extensions.DependencyInjection (>= 8.0.0)
- Microsoft.Extensions.Hosting (>= 8.0.0)
- Microsoft.Extensions.Logging (>= 8.0.0)
- Microsoft.Extensions.Logging.Configuration (>= 8.0.0)
- NLog (>= 5.3.3)
- NLog.Extensions.Logging (>= 5.3.12)
- Scrutor (>= 4.2.2)
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 |
---|---|---|
3.0.4 | 1,391 | 11/28/2024 |
3.0.4-rc.0 | 46 | 10/28/2024 |
3.0.3 | 2,514 | 10/9/2024 |
3.0.3-rc.0 | 56 | 10/8/2024 |
3.0.2 | 285 | 10/4/2024 |
3.0.2-rc.0 | 50 | 10/3/2024 |
3.0.1 | 106 | 10/2/2024 |
3.0.0-rc.3 | 98 | 9/17/2024 |
3.0.0-rc.2 | 637 | 9/9/2024 |
3.0.0-rc.1 | 51 | 9/6/2024 |
3.0.0-rc.0 | 58 | 8/28/2024 |
3.0.0-alpha.1 | 52 | 8/28/2024 |
3.0.0-alpha.0 | 50 | 8/27/2024 |
2.0.2 | 4,360 | 6/6/2024 |
2.0.1 | 113 | 6/6/2024 |
2.0.0-rc.0 | 5,125 | 8/24/2023 |
2.0.0-alpha.0 | 99 | 7/20/2023 |
1.1.0-beta0001 | 10,501 | 10/17/2022 |
1.0.3 | 71,425 | 6/17/2022 |