AgentSkillsCN

generic-host-dotnet

适用于使用 .NET 通用主机进行应用启动与生命周期的结构化设计,以实现配置、日志记录与依赖注入。

SKILL.md
--- frontmatter
name: generic-host-dotnet
description: Use when structuring application startup and lifetime using the .NET Generic Host for configuration, logging, and dependency injection.
  • Use HostBuilder to configure services, logging, and configuration
  • Centralize application startup and shutdown logic
  • Support graceful startup and disposal of services
  • Allow background services when appropriate, but do not require them
  • Keep UI lifecycle and host lifecycle coordinated

Framework guidance:

  • .NET: Microsoft.Extensions.Hosting
  • Compatible with WPF and Avalonia desktop applications
  • Do not assume ASP.NET or web hosting semantics
  • Do not introduce additional hosting abstractions unless approved