Migrate controllers to Minimal APIs using API versioning
Download the code that shows how to migrate controllers to Minimal API endpoints using API versioning in an ASP.NET Core Web API.
You can learn more about how to migrate from controllers to Minimal APIs, or watch the video.
Download the code example
You'll need to fill out the code example form. We will send you an email where you can download the code example.
Software
This is the software that will need to be installed onto your machine.
Visual Studio 2026. Version 18.0.0 or above. It will work with the free community version.
.NET 10 SDK. Version 10.0.0 or above.
The application
Open up RoundTheCode.MigrateToMinApis.slnx, and run the application. The Swagger documentation will load at https://localhost:7156/swagger.
You can switch definitions in the top-right hand corner of the Swagger documentation.V1 shows the controller endpoints, and V2 shows the same endpoints using Minimal APIs.
Download this code example
Enter your email and we'll send you a download link.
Related code examples
Download this Minimal API authentication example where API key security has been added through an authentication handler, and has been integrated with Swagger.
An ASP.NET Core code sample that features examples of FromQuery, FromHeader, FromForm, FromRoute, FromServices and FromBody in a Web API.
Download this code example
Enter your email and we'll send you a download link.