<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/understanding-swagger-integration-in-net-core-eonl3jnml" -->

---
title: Understanding Swagger integration in .NET Core | daily.dev
description: A step-by-step walkthrough shows how to integrate Swagger (via Swashbuckle.AspNetCore 5.5.0) into a .NET Core 3 API project, covering installing NuGet...
canonical: https://daily.dev/posts/understanding-swagger-integration-in-net-core-eonl3jnml
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Understanding Swagger integration in .NET Core | daily.dev
og:description: A step-by-step walkthrough shows how to integrate Swagger (via Swashbuckle.AspNetCore 5.5.0) into a .NET Core 3 API project, covering installing NuGet...
og:url: https://daily.dev/posts/understanding-swagger-integration-in-net-core-eonl3jnml
og:image: https://api.daily.dev/og/posts/eOnl3Jnml.png
og:image:alt: Understanding Swagger integration in .NET Core
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Understanding Swagger integration in .NET Core

**[Code4IT](https://daily.dev/sources/code4it)** · 8 min read · 0 upvotes · 0 comments

## Summary

A step-by-step walkthrough shows how to integrate Swagger (via Swashbuckle.AspNetCore 5.5.0) into a .NET Core 3 API project, covering installing NuGet packages, configuring the Swagger generator and middleware in Startup.cs, setting Swagger as the startup page, adding XML comments for endpoint documentation, and annotating endpoints with ProducesResponseType attributes to display expected status codes in the Swagger UI.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.code4it.dev/blog/swagger-integration>

## Questions this post answers

### How do I add Swagger to a .NET Core 3 API project?

Install the Swashbuckle.AspNetCore NuGet package (version 5.5.0), which bundles SwaggerGen, Swagger, and SwaggerUi. In ConfigureServices, call services.AddSwaggerGen with an OpenApiInfo object specifying title and version. In Configure, add app.UseSwagger() and app.UseSwaggerUI(), pointing the SwaggerEndpoint to the generated swagger.json path, then browse to /swagger/index.html.

_Developers wiring up API docs can find setup walkthroughs like this one on daily.dev._

### Why don't my XML comments show up in the Swagger UI for my .NET Core API?

SwaggerGen only reads executable code, not comments, so you must enable XML documentation file generation in the project's Build properties, then reference that generated XML file in ConfigureServices using IncludeXmlComments with a path built via Assembly.GetExecutingAssembly and Path.Combine with AppContext.BaseDirectory.

_Anyone polishing API docs for teammates can track tips like this on daily.dev._

### How do I show possible HTTP status codes for an endpoint in Swagger UI?

Add ProducesResponseType attributes above the endpoint method, one per expected status code, such as [ProducesResponseType(StatusCodes.Status200OK)] and [ProducesResponseType(StatusCodes.Status500InternalServerError)]. Swagger then displays these status codes in the generated UI so API consumers know what responses to expect.

_Teams documenting API contracts can keep practical .NET tips flowing through daily.dev._

## Similar posts on daily.dev

- [Combining API versioning with OpenAPI in .NET 10 applications](https://daily.dev/posts/combining-api-versioning-with-openapi-in-net-10-applications-gmga4jjr0) · ASP.NET Blog · 25 upvotes · 0 comments
- [How to Upgrade ASP.NET MVC to .NET Step by Step](https://daily.dev/posts/how-to-upgrade-asp-net-mvc-to-net-step-by-step-i3p1uesfs) · C\# Corner · 2 upvotes · 0 comments
- [ASP.NET Core Controllers: A Practical Guide to Building REST Endpoints](https://daily.dev/posts/asp-net-core-controllers-a-practical-guide-to-building-rest-endpoints-qbrdx5rqi) · We Are .NET · 0 upvotes · 0 comments
- [How to Migrate from ASP.NET Framework to ASP.NET Core](https://daily.dev/posts/how-to-migrate-from-asp-net-framework-to-asp-net-core-e22ntd3va) · freeCodeCamp · 4 upvotes · 0 comments
- [OpenAPI.NET: The Biggest Update Ever](https://daily.dev/posts/openapi-net-the-biggest-update-ever-6ww2r9niu) · DevBlogs · 45 upvotes · 0 comments

---

Tags: [#backend](https://daily.dev/tags/backend), [#c#](https://daily.dev/tags/c#), [#.net-core](https://daily.dev/tags/.net-core), [#openapi](https://daily.dev/tags/openapi)

[View this post on daily.dev](https://daily.dev/posts/understanding-swagger-integration-in-net-core-eonl3jnml)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Understanding Swagger integration in .NET Core","url":"https://daily.dev/posts/understanding-swagger-integration-in-net-core-eonl3jnml","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/understanding-swagger-integration-in-net-core-eonl3jnml"},"datePublished":"2026-10-04T13:06:38.972Z","dateModified":"2026-10-04T13:13:25.154Z","description":"A step-by-step walkthrough shows how to integrate Swagger (via Swashbuckle.AspNetCore 5.5.0) into a .NET Core 3 API project, covering installing NuGet...","image":"https://media.daily.dev/image/upload/s--HRgLpUt6--/f_auto/v1722860399/public/Placeholder%2003","thumbnailUrl":"https://media.daily.dev/image/upload/s--HRgLpUt6--/f_auto/v1722860399/public/Placeholder%2003","isAccessibleForFree":true,"articleSection":"Code4IT","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Code4IT","logo":"https://media.daily.dev/image/upload/s--OaaG4G10--/f_auto,q_auto/v1791119049/logos/code4it?_a=BAMAMicg0","url":"https://daily.dev/sources/code4it"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/understanding-swagger-integration-in-net-core-eonl3jnml","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"backend,c#,.net-core,openapi","timeRequired":"PT8M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Code4IT","item":"https://daily.dev/sources/code4it"},{"@type":"ListItem","position":3,"name":"Understanding Swagger integration in .NET Core"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/understanding-swagger-integration-in-net-core-eonl3jnml#faq","mainEntity":[{"@type":"Question","name":"How do I add Swagger to a .NET Core 3 API project?","acceptedAnswer":{"@type":"Answer","text":"Install the Swashbuckle.AspNetCore NuGet package (version 5.5.0), which bundles SwaggerGen, Swagger, and SwaggerUi. In ConfigureServices, call services.AddSwaggerGen with an OpenApiInfo object specifying title and version. In Configure, add app.UseSwagger() and app.UseSwaggerUI(), pointing the SwaggerEndpoint to the generated swagger.json path, then browse to /swagger/index.html. Developers wiring up API docs can find setup walkthroughs like this one on daily.dev."}},{"@type":"Question","name":"Why don't my XML comments show up in the Swagger UI for my .NET Core API?","acceptedAnswer":{"@type":"Answer","text":"SwaggerGen only reads executable code, not comments, so you must enable XML documentation file generation in the project's Build properties, then reference that generated XML file in ConfigureServices using IncludeXmlComments with a path built via Assembly.GetExecutingAssembly and Path.Combine with AppContext.BaseDirectory. Anyone polishing API docs for teammates can track tips like this on daily.dev."}},{"@type":"Question","name":"How do I show possible HTTP status codes for an endpoint in Swagger UI?","acceptedAnswer":{"@type":"Answer","text":"Add ProducesResponseType attributes above the endpoint method, one per expected status code, such as [ProducesResponseType(StatusCodes.Status200OK)] and [ProducesResponseType(StatusCodes.Status500InternalServerError)]. Swagger then displays these status codes in the generated UI so API consumers know what responses to expect. Teams documenting API contracts can keep practical .NET tips flowing through daily.dev."}}]}
```

