Nano.App.Console
10.0.0-preview1
See the version list below for details.
dotnet add package Nano.App.Console --version 10.0.0-preview1
NuGet\Install-Package Nano.App.Console -Version 10.0.0-preview1
<PackageReference Include="Nano.App.Console" Version="10.0.0-preview1" />
<PackageVersion Include="Nano.App.Console" Version="10.0.0-preview1" />
<PackageReference Include="Nano.App.Console" />
paket add Nano.App.Console --version 10.0.0-preview1
#r "nuget: Nano.App.Console, 10.0.0-preview1"
#:package Nano.App.Console@10.0.0-preview1
#addin nuget:?package=Nano.App.Console&version=10.0.0-preview1&prerelease
#tool nuget:?package=Nano.App.Console&version=10.0.0-preview1&prerelease
Nano.App.Console
Nano Console application.
Table of Contents
Summary
The NanoConsoleApplication is a ready-to-use application template for building console-based workers with Nano.
At its core, it is a standard console application that starts and executes one or more workers. When deployed to Kubernetes, it is typically configured
to run as a CronJob, while in the Development environment it simply runs as a normal console application without any scheduling.
The application derives from BaseNanoApplication and implements the IApplication interface, following established Nano application patterns.
It provides a concrete and opinionated implementation tailored specifically for console workloads.
NanoConsoleApplication exposes convenient static factory methods for creating and configuring the application with sensible defaults,
while still allowing full customization through configuration and the ConfigureServices method. This ensures that all core application behaviors are
initialized consistently from configuration, reducing boilerplate code and simplifying the creation of new console applications.
⚠️ Before proceeding, it is highly recommended to familiarize yourself generally with Nano Applications.
Registration
First install the Nano.App.Console NuGet package.
dotnet add package Nano.App.Console;
Then, to create a NanoConsoleApplication simply add the following code to program.cs.
NanoConsoleApplication
.ConfigureApp()
.ConfigureServices(x =>
{
// Your services...
})
.Build()
.Run();
Register your custom services in the ConfigureServices(x => { }) method to extend Nano with additional functionality or integrations.
Configuration
The App section in the configuration defines behavior related to the application.
| Setting | Type | Default | Description |
|---|---|---|---|
Version |
string | 1.0.0.0 | Application version identifier. |
Localization |
object | null | Localization configuration options. See Localization. |
Apis |
dictionary | [] | Named Nano API client configurations available to the application. See Api-Client. |
"App":
{
"Version": "1.0.0.0",
"Localization": null,
"Apis": null
}
📖 Learn more about Application Configuration here.
Localization
The Nano configuration supports specifying a default CultureInfo for console applications, ensuring that culture-sensitive operations
such as date, number, and currency formatting—are applied consistently across the entire application lifecycle.
The DefaultCultureInfo will be set to the configured default culture.
| Setting | Type | Default | Description |
|---|---|---|---|
DefaultCulture |
string | en-US | The default culture used by the application. |
"Localization": {
"DefaultCulture": "en-US"
}
Exception Handling
Exceptions thrown by individual Nano workers are handled internally, ensuring that failures in one worker do not impact the execution of others.
When a Logging Provider is registered, any worker that fails will automatically log the exception.
No additional configuration or setup is required.
Try it out yourself using the Api.ExceptionHandling example.
Api Clients
Nano API clients provide a consistent and structured way for applications to communicate with other Nano API services.
In console applications, they allow worker processes to establish connections with one or more Nano API applications, send requests, and retrieve responses in a reliable and predictable manner. This enables console workers to leverage the functionality of multiple Nano services while keeping service boundaries clear and maintaining consistent error handling, logging, and response propagation across the system.
📖 Learn more Nano Api Clients
Console Workers
You can implement as many workers as you need by creating classes that implement IWorker.
All registered workers will run automatically when the application starts, and the application will shut down once all workers have completed their execution.
For convenience, derive your worker from BaseWorker. This allows you to only implement OnStartAsync() if you don't need any custom logic in OnStopAsync().
public class MyWorker(ILogger logger)
: BaseWorker(logger)
{
public override async Task OnStartAsync(CancellationToken cancellationToken = default)
{
// Your startup logic here...
}
// Optional
public override async Task OnStopAsync(CancellationToken cancellationToken = default)
{
// Your shutdown/cleanup logic here...
}
}
You can inject any registered service your worker needs, including scoped services, which will be correctly resolved when the worker is executed.
Try it out yourself using the Console.Workers example.
Startup Tasks
Nano Console applications supports start-up tasks that execute before the application begins processing requests.
The console worker won't start until all configured start-up tasks have completed successfully.
While start-up tasks are rarely required for console applications, this feature is available to ensure any necessary initialization can be performed before the worker starts.
📖 Learn more Nano Startup Tasks.
Try it out yourself using the Api.StartupTasks example.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | 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. |
-
net10.0
- Nano.App (>= 10.0.0-preview1)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Nano.App.Console:
| Package | Downloads |
|---|---|
|
Nano.All
This package is part of the Nano Library, a set of reusable .NET libraries for building microservice applications. Nano addresses common non-business concerns such as logging, persistence, messaging, validation, and documentation, while remaining fully configurable and extensible, so applications can stay focused on business logic. See https://github.com/Nano-Core/Nano.Library for details. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 10.0.0-preview2 | 65 | 4/25/2026 |
| 10.0.0-preview1 | 66 | 4/24/2026 |
- .NET 10 support.
- Comprehensive rewrite with performance optimizations, improvements, and bug fixes.
- Not compatible with previous versions of Nano.