SwaggerUI.AspNetCore
5.30.1
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package SwaggerUI.AspNetCore --version 5.30.1
NuGet\Install-Package SwaggerUI.AspNetCore -Version 5.30.1
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.30.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SwaggerUI.AspNetCore" Version="5.30.1" />
<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.30.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: SwaggerUI.AspNetCore, 5.30.1"
#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.30.1
#: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.30.1
#tool nuget:?package=SwaggerUI.AspNetCore&version=5.30.1
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.AspNetCoreSetup with code
Add
MapSwaggerUIinto 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");
routePrefixset the swagger-ui access pathopenApiEndpointset the openapi doc access pathaspnetcore apitemplate in.net9default is/openapi/v1.json- Support
relative pathorabsolute path- If use
swagger. Normally, the path is/swagger/v1/swagger.json - If set to a non-same-origin
absolute path,CORSis 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 is compatible. 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.
-
net9.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.31.0 | 179 | 12/13/2025 |
| 5.30.3 | 215 | 11/26/2025 |
| 5.30.2 | 773 | 11/11/2025 |
| 5.30.1 | 3,162 | 11/1/2025 |
| 5.30.0 | 1,166 | 10/28/2025 |
| 5.29.5 | 2,768 | 10/19/2025 |
| 5.29.4 | 2,016 | 10/11/2025 |
| 5.29.0 | 8,742 | 9/10/2025 |
| 5.28.1 | 807 | 9/6/2025 |
| 5.28.0 | 1,922 | 8/30/2025 |
| 5.27.1 | 5,778 | 8/10/2025 |
| 5.27.0 | 4,773 | 7/21/2025 |
| 5.26.2 | 1,393 | 7/8/2025 |
| 5.26.0 | 537 | 7/6/2025 |
| 5.26.0-preview-002 | 173 | 7/5/2025 |
| 5.26.0-preview-001 | 132 | 7/4/2025 |