I have a standard .NET windows service written in C#.
Can it install itself without using InstallUtil? Should I use the service installer class? How should I use it?
I want to be able to call the following:
MyService.exe -install
And it will have the same effect as calling:
InstallUtil MyService.exe
Yes, that is fully possible (i.e. I do exactly this); you just need to reference the right dll (System.ServiceProcess.dll) and add an installer class…
Here’s an example: