title: How to debug the installation of a custom Windows service?
body: <p>I created a Windows service in C# (4.0) and am trying to install it using installutil tool in command line. However I get an exception. I managed to find out what part of my code is causing the exception - using some crappy logging but whatever - but now I want to understand why. So what I want to do is debugging the installation of my Windows Service.</p>
  
  <p>I know how to debug the service itself, but here, I want to debug the content of my <code>Installer.Install(IDictionary stateSaver)</code> method in the service.</p>
  
  <p>I tried to attach the debugger to the cmd.exe process but it obviously doesn't work. I was thinking also to attach the debugger to the installutil process but I have no clue how to do this.</p>
  
  <p>I had a look to this post: <a href="https://stackoverflow.com/questions/2604265/how-do-you-debug-a-windows-service-that-is-being-installed">How do you debug a windows service that is being installed?</a> and several others but in this case, for some reason, this guy seem to have his service already in the services.msc which is not my case.</p>
  
  <p>How can I achieve this?</p>