dotnet-expert

Provides .NET 10 LTS reference guidance covering SDK, ASP.NET Core, EF Core, testing, and publishing.

Updated Jun 24, 2026
One-click install
npx skills add https://github.com/psmfd/pi-config --skill dotnet-expert-psmfd
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: dotnet-expert
Source: https://github.com/psmfd/pi-config/tree/main/agent/skills/dotnet-expert
Command: npx skills add https://github.com/psmfd/pi-config --skill dotnet-expert-psmfd

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Developers working on .NET projects often need authoritative, up-to-date guidance on SDK configuration, ASP.NET Core patterns, dependency injection lifetimes, EF Core pitfalls, and cross-platform publishing without searching scattered documentation. ## Core Features & Use Cases - SDK and Project Configuration: Covers csproj structure, Directory.Build.props, Central Package Management, and runtime identifiers for cross-platform builds. - ASP.NET Core and Worker Services: Documents minimal APIs, middleware ordering, options pattern, BackgroundService lifecycle, and DI lifetime traps. - EF Core, Testing, and Security: Explains DbContext scoping, migrations, connection resiliency, WebApplicationFactory testing, secrets management, and container publishing. - Use Case: When building a worker service that processes a queue with EF Core, consult this reference to correctly create scoped DbContext instances inside a singleton BackgroundService and avoid lifetime mismatch bugs. ## Quick Start Ask the dotnet-expert subagent how to configure dependency injection lifetimes and publish a container image for a .NET 10 web API.

Frequently Asked Questions about dotnet-expert

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I use scoped services like DbContext inside a BackgroundService?▼

BackgroundService is a singleton, so inject IServiceScopeFactory and create a scope manually inside ExecuteAsync. Resolve the DbContext from that scope each iteration and dispose the scope with a using declaration.

What is the difference between IOptions, IOptionsSnapshot, and IOptionsMonitor?▼

IOptions is a singleton that reads configuration once and never reloads. IOptionsSnapshot is scoped and reloads per request, while IOptionsMonitor is a singleton that supports change notifications via an OnChange callback.

How do I publish a .NET app as a container image without a Dockerfile?▼

Run dotnet publish with /t:PublishContainer and set ContainerRepository and ContainerImageTag properties. The .NET SDK produces an OCI image directly without requiring a Dockerfile.

Why does my singleton capturing a scoped service work in development but fail in production?▼

ValidateScopes is enabled by default in Development but disabled in Production, so the lifetime mismatch throws early in development but silently misbehaves in production. Enable ValidateScopes and ValidateOnBuild explicitly to catch this at startup.

When should I use var versus explicit types in C#?▼

This reference mandates explicit types everywhere except anonymous types from LINQ projections, enforced by promoting IDE0008 to error severity. Rare exceptions require a pragma suppression with a mandatory justification comment.

Does .NET 10 support AOT compilation and cross-platform builds?▼

Yes, .NET 10 supports native AOT via /p:PublishAot=true and targets linux-x64, linux-arm64, osx-arm64, osx-x64, and win-x64 runtime identifiers. AOT builds require explicit RID targeting for native dependencies.