SwaggerUI.AspNetCore
5.27.0
dotnet add package SwaggerUI.AspNetCore --version 5.27.0
NuGet\Install-Package SwaggerUI.AspNetCore -Version 5.27.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SwaggerUI.AspNetCore" Version="5.27.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SwaggerUI.AspNetCore" Version="5.27.0" />
<PackageReference Include="SwaggerUI.AspNetCore" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add SwaggerUI.AspNetCore --version 5.27.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: SwaggerUI.AspNetCore, 5.27.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package SwaggerUI.AspNetCore@5.27.0
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=SwaggerUI.AspNetCore&version=5.27.0
#tool nuget:?package=SwaggerUI.AspNetCore&version=5.27.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
SwaggerUI.AspNetCore
A swagger-ui dist package for aspnetcore. Let the aspnetcore program provide swagger-ui endpoint.
- Provides minimizing and original swagger-ui
- Lightweight and fast (Pre gzip and simple mapping)
- Pre configured for
Microsoft.AspNetCore.OpenApi
How to use
Install package
dotnet add package SwaggerUI.AspNetCore
Setup with code
Add
MapSwaggerUI
into request pipeline.app.MapSwaggerUI();
Now it will work with Microsoft.AspNetCore.OpenApi
(aspnetcore api
template version of .net9
or higher). Now access /swagger
, you will see swagger-ui.
Configure
simple configuration
app.MapSwaggerUI(routePrefix: "/swagger",
openApiEndpoint: "/openapi/v1.json");
routePrefix
set the swagger-ui access pathopenApiEndpoint
set the openapi doc access pathaspnetcore api
template in.net9
default is/openapi/v1.json
- Support
relative path
orabsolute path
- If use
swagger
. Normally, the path is/swagger/v1/swagger.json
- If set to a non-same-origin
absolute path
,CORS
is required
- If use
full configuration
app.MapSwaggerUI(options =>
{
options.RoutePrefix = "/swagger";
//support named and multi openapi endpoint
options.OpenApiEndpoints.Add("/openapi/v1.json");
//Javascript code run before swagger-ui initialization
options.CustomCodeBeforeInitialization =
"""
alert("Hello");
""";
//Javascript object to set and override all configuration before
options.CustomConfigurationObject =
"""
{
url: null,
urls: [ { url: "/openapi/v1.json", name: "default"}]
}
""";
});
Support full swagger-ui configuration by set Javascript object code
for CustomConfigurationObject
More configuration references: swagger-ui configuration doc
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net8.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last Updated |
---|---|---|
5.27.0 | 47 | 7/21/2025 |
5.26.2 | 1,327 | 7/8/2025 |
5.26.0 | 338 | 7/6/2025 |
5.26.0-preview-002 | 108 | 7/5/2025 |
5.26.0-preview-001 | 69 | 7/4/2025 |