Windows Service template project
Features
- Easy installation and deinstallation
- Easy service name change without rebuild (through app.config)
- Built-in debug mode. You no longer need a separate console application to debug your service
Integration in your solution
- Clone or download the project
- Rename WinSvc.csproj as you need
- Connect the project to your solution
- Change the project assembly name and namespace
- If you using VisualStudio or Rider with installed VisualStudio 2017 -
install.bat
and delete.bat
will be regenerated on build.
Otherwise you’ll need to update them yourself with new assembly name.
- Configure
ServiceName
in app.config
- Implement
OnStart
and OnStop
behavior in MyService.cs
Using
Installation
To install your service as Windows Service
- Build the project
- Start
install.bat
from the output dir (with admin)
- Now you can see your service in the Windows Services list
Uninstallation
To uninstall your Windows Service run delete.bat
with admin. That’s stop your service and removes it from the Windows Services list.
Debug
To debug your service configure your IDE to start the project with /d
key. Now just hit ‘F5’ without any service installation.
Roadmap
Autogenerate install.bat and delete.bat on build
- Autogeneration without VisualStudio installed
- Create Rider project template