From 76cfe4dc460cea8363f631f2f8a185883cb062c1 Mon Sep 17 00:00:00 2001 From: TekH Date: Sat, 30 May 2026 16:46:27 +0200 Subject: [PATCH] Add conditional MapOpenApi for .NET 9.0 or newer Introduced a preprocessor directive `#if NET9_0_OR_GREATER` to conditionally include the `app.MapOpenApi();` method call. This ensures that the `MapOpenApi` functionality is only executed when the application targets .NET 9.0 or later, maintaining compatibility with earlier .NET versions. --- EnvelopeGenerator.API/Program.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/EnvelopeGenerator.API/Program.cs b/EnvelopeGenerator.API/Program.cs index b7f53299..321e1c12 100644 --- a/EnvelopeGenerator.API/Program.cs +++ b/EnvelopeGenerator.API/Program.cs @@ -290,7 +290,9 @@ try app.UseMiddleware(); +#if NET9_0_OR_GREATER app.MapOpenApi(); +#endif // Configure the HTTP request pipeline. if (app.Environment.IsDevelopment() || (app.IsDevOrDiP() && config.GetValue("UseSwagger")))