
Maui Dependency Injection
by dotnet0608d8924cd3MIT5.5K starsListed Oct 8, 2026Updated Oct 8, 2026Repository updated today
Guidance for configuring dependency injection in .NET MAUI apps — service registration in MauiProgram.cs, lifetime selection (Singleton / Transient / Scoped), constructor injection, Shell navigation auto-resolution, platform-specific registrations, and testability patterns. USE FOR: "dependency injection", "DI setup", "AddSingleton", "AddTransient", "AddScoped", "service registration", "constructor injection", "IServiceProvider", "MauiProgram DI", "register services", "BindingContext injection". DO NOT USE FOR: data binding (use maui-data-binding), Shell route configuration (use maui-shell-navigation), unit-test mocking frameworks (use standard xUnit and NSubstitute patterns).
Only the file list is public. File contents are available once the skill is installed in a workspace.
| Path | Size | Type |
|---|---|---|
| references/dependency-injection-api.md | 4.1 KB | text/markdown |
| SKILL.md | 14.1 KB | text/markdown |
Source and attribution
Source:dotnet/skillsinplugins/dotnet-maui/skills/maui-dependency-injectionat commit0608d89
License: MIT
Content belongs to its original authors. SourceWeft indexes it from a public repository.
More from dotnet/skills

Setup Local Sdk
dotnet
Guides installing a project-local .NET SDK in .dotnet/ and wiring it through global.json paths.

System Text Json Net11
dotnet
Guides use of three System.Text.Json APIs added in .NET 11: PascalCase naming policy and generic type-info accessors.

Thread Abort Migration
dotnet
Guides migrating .NET Framework Thread.Abort usage to cooperative cancellation in modern .NET.

Migrate Dotnet9 To Dotnet10
dotnet
Guides migration of a .NET 9 project or solution to .NET 10, resolving breaking changes.

Target Authoring
dotnet
Canonical patterns for authoring custom MSBuild targets, including dependency chains, extension, and incrementality.

Resolve Project References
dotnet
Explains why ResolveProjectReferences time in MSBuild summaries is misleading and redirects optimization to task self-time.