From 589e2adf7b4bda5e860e237ef2a3ff41263bf794 Mon Sep 17 00:00:00 2001 From: thorsten Date: Fri, 12 Jun 2026 19:36:16 +0200 Subject: [PATCH] feat: add net8.0 target framework netstandard2.0 consumers on .NET 8 fell back to the netstandard2.0 asset, which excludes ASP.NET Core instrumentation. A dedicated net8.0 target gives .NET 8 (LTS) consumers the full feature set, on par with net10.0. --- AGENTS.md | 11 +++++++---- README.md | 4 ++-- .../OpenTelemetryExtension.Configuration.csproj | 2 +- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index 230805f..1bb3ebd 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -13,7 +13,7 @@ NuGet package that wires up OpenTelemetry (tracing, metrics, logging) for ``` src/ Directory.Build.props # Shared props: nullable, implicit usings, warnings-as-errors, style enforced in build - OpenTelemetryExtension.Configuration/ # Library (netstandard2.0 + net10.0) — the shipped NuGet package + OpenTelemetryExtension.Configuration/ # Library (netstandard2.0 + net8.0 + net10.0) — the shipped NuGet package OpenTelemetryExtension.Configuration.Tests/ # xUnit unit tests (net10.0, in-process, Category=Unit) OpenTelemetryExtension.Configuration.IntegrationTests/ # Integration tests (net10.0, Category=Integration) — query a live OpenObserve OpenTelemetryExtension.Configuration.Sample.WebApi/ # ASP.NET Core sample app (net10.0) @@ -125,9 +125,12 @@ API to confirm the data was ingested. - C# with nullable reference types enabled — never use `!` to suppress nullability without a comment explaining why -- Target frameworks: `netstandard2.0` and `net10.0` — guard net5.0+ APIs with - `#if NET5_0_OR_GREATER`. Do not use APIs unavailable on `netstandard2.0` - without the guard. +- Target frameworks: `netstandard2.0`, `net8.0` and `net10.0` — guard net5.0+ + APIs with `#if NET5_0_OR_GREATER` (or `#if !NETSTANDARD2_0`). Do not use APIs + unavailable on `netstandard2.0` without the guard. The ASP.NET Core + instrumentation is referenced for every target except `netstandard2.0`, so + `net8.0` and `net10.0` consumers get it; `netstandard2.0` (WPF/console) stays + lean. - `src/Directory.Build.props` applies to every project: `Nullable`, `ImplicitUsings`, `LangVersion=latest`, `TreatWarningsAsErrors=true`, `EnforceCodeStyleInBuild=true` — a style violation fails the build diff --git a/README.md b/README.md index 031b4e4..83a5667 100644 --- a/README.md +++ b/README.md @@ -25,9 +25,9 @@ Configurable OpenTelemetry setup for .NET applications providing **tracing, metr ## ✅ Requirements -- A .NET target compatible with **`netstandard2.0`** — i.e. .NET Framework 4.6.1+, .NET 6/8/9/10, or .NET 10 directly. +- A .NET target compatible with **`netstandard2.0`** — i.e. .NET Framework 4.6.1+, .NET 6/8/9/10, or directly the **`net8.0`** / **`net10.0`** builds. - An **OTLP-compatible backend** to receive the telemetry (collector, Jaeger, OpenObserve, the .NET Aspire Dashboard, …). See [Running Locally with a Backend](#-running-locally-with-a-backend). -- ASP.NET Core instrumentation requires a **web target** (`net10.0` build); it is not included in the `netstandard2.0` build used by WPF/console apps. +- ASP.NET Core instrumentation requires a modern .NET target (**`net8.0`** or **`net10.0`** build); it is not included in the `netstandard2.0` build used by WPF/console apps. --- diff --git a/src/OpenTelemetryExtension.Configuration/OpenTelemetryExtension.Configuration.csproj b/src/OpenTelemetryExtension.Configuration/OpenTelemetryExtension.Configuration.csproj index d765970..94bbde8 100644 --- a/src/OpenTelemetryExtension.Configuration/OpenTelemetryExtension.Configuration.csproj +++ b/src/OpenTelemetryExtension.Configuration/OpenTelemetryExtension.Configuration.csproj @@ -1,7 +1,7 @@  - netstandard2.0;net10.0 + netstandard2.0;net8.0;net10.0 2.0.1 false true