diff --git a/WebStarter/Program.cs b/WebStarter/Program.cs index 0f9860c..d730f5f 100644 --- a/WebStarter/Program.cs +++ b/WebStarter/Program.cs @@ -43,6 +43,16 @@ builder.Services.AddCors(options => ); }); +builder.Services.AddSwaggerGen(c => +{ + string? basePath = Path.GetDirectoryName(typeof(Program).Assembly.Location); //获取应用程序所在目录 + if (basePath != null) + { + string xmlPath = Path.Combine(basePath, "WebStarter.xml"); + c.IncludeXmlComments(xmlPath); + } +}); + builder.Services.AddControllers().AddJsonOptions(configure => { configure.JsonSerializerOptions.Converters.Add(new DatetimeJsonConverter());