diff --git a/aspnetcore/tutorials/web-api-help-pages-using-swagger/samples/2.1/TodoApi.NSwag/Startup.cs b/aspnetcore/tutorials/web-api-help-pages-using-swagger/samples/2.1/TodoApi.NSwag/Startup.cs index 846609ac4f..097449ae83 100644 --- a/aspnetcore/tutorials/web-api-help-pages-using-swagger/samples/2.1/TodoApi.NSwag/Startup.cs +++ b/aspnetcore/tutorials/web-api-help-pages-using-swagger/samples/2.1/TodoApi.NSwag/Startup.cs @@ -28,10 +28,13 @@ namespace TodoApi // Register the Swagger generator and the Swagger UI middlewares app.UseOpenApi(); - app.UseSwaggerUi3(); + if (app.Environment.IsDevelopment()) + { + app.UseSwaggerUi3(); + } app.UseMvc(); } // } -} \ No newline at end of file +}