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.
This commit is contained in:
@@ -290,7 +290,9 @@ try
|
||||
|
||||
app.UseMiddleware<ExceptionHandlingMiddleware>();
|
||||
|
||||
#if NET9_0_OR_GREATER
|
||||
app.MapOpenApi();
|
||||
#endif
|
||||
|
||||
// Configure the HTTP request pipeline.
|
||||
if (app.Environment.IsDevelopment() || (app.IsDevOrDiP() && config.GetValue<bool>("UseSwagger")))
|
||||
|
||||
Reference in New Issue
Block a user