In this short article, I’ll show you a way to make your Windows Services install themselves without needing InstallUtil.exe at all.
Thanks to Reflector for .NET by Lutz Roeder, it’s easy to discover that InstallUtil.exe tool jumps to a method called
System.Configuration.Installnamespace. And what’s really interesting is that the command line arguments passed to InstallUtil.exe as an array of strings are then passed directly to this helper method.
// First create a new .cs file with the following code
// Add Reference to System.Configuration.Install.dll from the Global Assembly Cache