Raycynix.Extensions.Serilog.Aspire 3.0.0

dotnet add package Raycynix.Extensions.Serilog.Aspire --version 3.0.0
                    
NuGet\Install-Package Raycynix.Extensions.Serilog.Aspire -Version 3.0.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="Raycynix.Extensions.Serilog.Aspire" Version="3.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Raycynix.Extensions.Serilog.Aspire" Version="3.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Raycynix.Extensions.Serilog.Aspire" />
                    
Project file
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 Raycynix.Extensions.Serilog.Aspire --version 3.0.0
                    
#r "nuget: Raycynix.Extensions.Serilog.Aspire, 3.0.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 Raycynix.Extensions.Serilog.Aspire@3.0.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=Raycynix.Extensions.Serilog.Aspire&version=3.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Raycynix.Extensions.Serilog.Aspire&version=3.0.0
                    
Install as a Cake Tool

Raycynix.Extensions.Serilog.Aspire

Raycynix.Extensions.Serilog.Aspire adds the Raycynix Serilog pipeline to an Aspire AppHost through IDistributedApplicationBuilder.

Compatibility

  • .NET 10
  • Aspire.Hosting 13.4.6
  • Raycynix.Extensions.Serilog 3.0.0

Installation

dotnet add package Raycynix.Extensions.Serilog.Aspire

AppHost registration

using Raycynix.Extensions.Serilog.Aspire;

var builder = DistributedApplication.CreateBuilder(args);

builder.AddRaycynixSerilog();

builder.AddProject<Projects.Api>("api");
builder.AddProject<Projects.Worker>("worker");

builder.Build().Run();

The extension returns the same IDistributedApplicationBuilder, so normal Aspire resource registration can continue fluently.

What the package configures

The package configures the logging pipeline of the AppHost process itself. It uses the same behavior as the core package:

  • standard Microsoft ILogger<T> integration;
  • native Serilog configuration;
  • Raycynix:Serilog metadata conventions;
  • dependency-injected Serilog components;
  • fallback console output;
  • ordered logger and sink configurators.

Aspire resources are separate processes. AppHost service registration cannot modify the DI container of an orchestrated API, worker, executable, or container.

Configure every .NET resource

Each orchestrated .NET project should reference Raycynix.Extensions.Serilog and register it in its own host:

using Raycynix.Extensions.Serilog;

var builder = WebApplication.CreateBuilder(args);

builder.AddRaycynixSerilog();

var app = builder.Build();
app.Run();

For solutions with a shared ServiceDefaults project, place the core registration in the shared host-builder extension used by each service. Keep the Aspire package in AppHost only.

AppHost configuration

The AppHost reads the same sections as the core package:

{
  "Raycynix": {
    "Serilog": {
      "ServiceName": "commerce-apphost",
      "Environment": "Development"
    }
  },
  "Serilog": {
    "MinimumLevel": {
      "Default": "Information",
      "Override": {
        "Aspire": "Information",
        "Microsoft": "Warning",
        "System": "Warning"
      }
    },
    "WriteTo": [
      {
        "Name": "Console"
      }
    ]
  }
}

If Serilog:WriteTo is omitted, the core fallback console sink is used.

Configuration in code

The overload exposes the standard RaycynixSerilogBuilder callback:

builder.AddRaycynixSerilog(logging =>
{
    logging.Options.ServiceName = "commerce-apphost";
    logging.Options.ApplyDefaultLevelOverrides = false;

    logging.ConfigureLogger((context, configuration) =>
        configuration.Enrich.WithProperty("Orchestrator", "Aspire"));
});

Optional sinks

Optional Raycynix sink packages compose through the same callback. For example, after installing Raycynix.Extensions.Serilog.Elastic:

using Raycynix.Extensions.Serilog.Aspire;
using Raycynix.Extensions.Serilog.Elastic;

builder.AddRaycynixSerilog(logging =>
{
    logging.AddElastic();
});

This adds Elastic output to AppHost only. Resource projects require their own sink registration and configuration.

Registration rules

Call AddRaycynixSerilog() once for the AppHost service collection. Duplicate registration throws InvalidOperationException, matching the core package.

The Aspire package deliberately contains no resource annotations and does not inject logging configuration into child resources. This keeps secrets, environment-specific sink choices, and resource logging lifecycles explicit.

Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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.0 86 8/10/2026

v3.0.0 adds AddRaycynixSerilog for Aspire IDistributedApplicationBuilder, configures the AppHost process through the shared Raycynix Serilog pipeline, supports the core configuration callback and optional sink integrations, and documents the separate logging lifecycle of orchestrated resources.