Guide · Open source
How to use practical-aspnetcore: clone the repo and explore samples
Updated · written with AI from the project's own documentation and checked against our catalogue data
practical-aspnetcore is an MIT-licensed collection of small, working ASP.NET Core sample projects written in C#, organized by topic such as routing, middleware, Blazor, gRPC and authentication. This guide shows you how to get the code, find the sample for a feature you care about, and read or adapt it. By the end you will know where to look, how to pick the right branch for an older app, and when to use a different resource.
Quick start
- 1Install Git. Make sure Git is available on your command line so you can clone the repository.
- 2Clone the repository. Run git clone https://github.com/dodyg/practical-aspnetcore in the folder where you want the code.
- 3Pick a topic. Open the README's Sections table and choose the feature you want to learn, such as Minimal API or Blazor.
- 4Switch branches if needed. If you maintain an older app, check out the matching previous-version branch listed in the README.
- 5Read the sample and its explanation. Use the README explanation for that project to understand what the code is demonstrating.
- 6Copy only the pattern you need. Move the relevant parts into your own project and adjust them to your code and configuration.
What practical-aspnetcore contains
The repository is a reference collection rather than a single application. Its README describes it as practical samples of ASP.NET Core that you can use, with explanations for every project in the readme.
Each topic has its own folder, linked from a Sections table in the README. Topics include Authentication, Blazor (WebAssembly, Server and Server Side Render), Caching, Endpoint Routing, gRPC, HTMX, Minimal API, MVC, Razor Pages, SignalR, System.Text.Json and many more.
Get the code: clone the repository
The README's install step is to clone the repository with Git. The README does not list any other prerequisites or build steps, so check the individual sample folder for what it needs to run.
- Make sure Git is installed on your machine.
- Run the clone command below in the folder where you want the code to live.
- Open the cloned folder and browse to the topic you want.
git clone https://github.com/dodyg/practical-aspnetcoreFind a sample for the feature you need
Start from the topic, not from the file tree. If you want to learn how Minimal APIs handle routing or parameter binding, open the Minimal API section. If you need to see how a gRPC service is structured, open the gRPC section, which also covers grpc-Web.
Read the explanation for the project in the README before you copy anything. The samples are written to be read one feature at a time.
- Routing and endpoints: Endpoint Routing, Minimal API, Minimal Hosting
- Web UI: Razor Pages, MVC, Blazor, HTMX, Unpoly
- Data and output: Request, Response, System.Text.Json, Static Files
- Platform concerns: Authentication, Security, Caching, Logging, Health Check, Open Telemetry
Use the branch for an older ASP.NET Core version
The README says the main branch covers the newest ASP.NET Core release it lists, and it points to separate branches for earlier versions. If you maintain an older app, check out the branch that matches your framework rather than copying samples from main.
The README links branches named net6.0, net5.0, 3.1-LTS and 2.1-LTS. Samples for the newest release are described in a separate 'What's new' section.
- Look at the Previous versions list in the README to find the branch name.
- Switch to that branch after cloning, then open the topic you need.
- Confirm the framework your own project targets before copying code.
Adapt a sample for your own project
The samples are meant to be copied from. Pick one feature, read the sample end to end, then move only the parts you need into your own code. Keep your own naming, error handling and configuration, since the samples are focused demonstrations rather than complete apps.
The README describes these as samples, not production applications, so treat them as patterns to verify rather than finished architecture.
Look at related sample repositories
The README points to other sources for specific areas. Use these when a topic falls outside this collection.
- ATProtocol samples (the protocol behind Bluesky): the bluenile repository linked in the README
- Hydro Framework (Razor Pages compatible) samples: the hydro section linked in the README
- Official .NET Aspire samples: dotnet/aspire-samples
- Data access samples: Grauenwolf/DotNet-ORM-Cookbook
- General .NET samples: dotnet/samples
What people use it for
- Learning how Minimal APIs handle routing and parameter binding by reading one focused sample.
- Finding a working Blazor or gRPC example to compare against an existing project.
- Checking how a feature such as caching, logging or health checks is wired, then adapting that pattern.
- Looking up the way an older ASP.NET Core app was written by switching to the matching version branch.
Frequently asked questions
Is practical-aspnetcore free to use?
Yes. The repository is licensed under MIT, which the listing states. Check the LICENSE file in the repository for the full terms before you reuse code in a commercial project.
What do I need installed before I use practical-aspnetcore?
The README does not list any prerequisites. You need Git to clone the repository, and because the samples are C# projects, you should be comfortable with C# and ASP.NET Core to get value from them. Check each sample folder for what it needs to run.
Is practical-aspnetcore good for beginners?
It is best for developers who already know some C# and .NET. The samples assume that background, so complete beginners may find them hard to follow without learning the basics first.
Can I use practical-aspnetcore for a production app?
The README describes these as samples rather than full applications. Use them as reference patterns and build your own production structure around the parts you adopt.
How does practical-aspnetcore compare to dotnet/samples?
This repository is organized by ASP.NET Core topic and is meant for reading and copying single features. The dotnet/samples repository from the .NET team is a separate collection, and the README lists both as sources. Pick the one whose topics match what you need.
How do I use samples for an older ASP.NET Core version?
Check out the branch the README links for that version, such as the net6.0, net5.0, 3.1-LTS or 2.1-LTS branches, then open the topic you need. Samples on the main branch target the newer release.
New agent skills, repos and AI tools — every week
The best new skills and open-source projects, the fastest-growing repos, and one free prompt. Five minutes to read. Unsubscribe anytime.
Our verdict
Use practical-aspnetcore if you already know some C# and want focused, working examples of one ASP.NET Core feature at a time, or if you maintain an older app and need the matching branch. Pick something else if you need a step-by-step course for a complete beginner, a full production application, or a single guided project.
Install options & downloads