danielpohlmann/ia-marktplace/stack-topshelf
Claude Code and agent skill by danielpohlmann/ia-marktplace
- community
Checking that the SKILL.md file is still in the repository.
Use when maintaining a legacy .NET Windows service built on Topshelf. USE FOR: HostFactory.Run, install/uninstall from CLI, recovery options, console mode during development, .NET Framework service lifecycle. DO NOT USE FOR: new .NET 6+ services (use BackgroundService with AddWindowsService), Linux/systemd, ASP.NET Core hosting.
Install
npx vskill@latest install danielpohlmann/ia-marktplace/stack-topshelfSKILL.md
The same SKILL.md was published earlier as danielpohlmann/ia-marktplace/stack-topshelf.
Topshelf
Overview
Topshelf is a framework for hosting .NET applications as Windows services. It replaces the boilerplate ServiceBase class and InstallUtil.exe workflow with a fluent API for service configuration, installation, and lifecycle management. Services built with Topshelf run as console applications during development and as Windows services in production, without code changes.
Important: Topshelf was designed for .NET Framework and early .NET Core. For modern .NET 6+ applications, prefer BackgroundService with Microsoft.Extensions.Hosting.WindowsServices. Topshelf remains relevant for maintaining legacy services and for projects that need its specific service management features.
Install via NuGet:
Basic Service Definition
Define a service class with Start and Stop methods, then configure it with the Topshelf host factory.
Service with Pause and Continue
Implement pause/resume support for services that can be temporarily suspended.
Service Recovery Configuration
Configure automatic recovery actions when the service fails.
Dependency Injection Integration
Use a DI container with Topshelf for production services.
Command-Line Service Management
Topshelf provides built-in command-line arguments for installing, uninstalling, and managing the service.
Topshelf vs Modern .NET Hosting
| Feature | Topshelf | BackgroundService + WindowsServices | |
|---|---|---|---|
| .NET Framework | Yes | No | |
| .NET 6+ | Limited | Yes | |
| Linux support | No | Yes (with Systemd) | |
| CLI install/uninstall | Built-in | Manual (sc.exe or installer) | |
| Service recovery | Fluent API | Windows Service Manager | |
| Pause/continue | Built-in | Manual | |
| DI integration | Manual | Built-in | |
| Console mode | Automatic | Automatic | |
| Active development | Maintenance | Active |
Migration Path to Modern .NET
For new projects or migrations, convert Topshelf services to BackgroundService:
Best Practices
- Use Topshelf only for .NET Framework services or legacy maintenance -- for new .NET 6+ services, prefer
BackgroundServicewithAddWindowsService(). - Always return `true` from `Start` and `Stop` unless there is a genuine startup failure that should prevent the service from running.
- Configure service recovery with
EnableServiceRecoveryso the service restarts automatically after crashes without manual intervention. - Test as a console application first by running the executable directly -- Topshelf automatically detects console mode vs. service mode.
- Use `RunAsLocalSystem()` for services that do not need network access and
RunAsNetworkService()for services that need to authenticate on the network. - Set `StartAutomatically()` for production services so they start on system boot without manual intervention.
- Enable `EnableShutdown()` so the service responds properly to system shutdown events and has time to clean up resources.
- Use the `HostControl` parameter in `Start`/`Stop` to request service stop from within the service itself (e.g.,
hostControl.Stop()on unrecoverable error). - Integrate a DI container by building the service provider before
HostFactory.Runand resolving the service insideConstructUsing. - Plan migration to BackgroundService for any Topshelf service that will be upgraded to .NET 6+, since Topshelf is in maintenance mode and the modern hosting model is more capable and actively maintained.
References
See references/rules.md for the full rule catalog.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingstack/skills/stack-topshelf/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/danielpohlmann/ia-marktplace/stack-topshelf)