Monday, April 29, 2013

Windows Service Installer Error 1001: Cannot start service on computer %1 is not a valid Win32 application

Problem
I was working on a windows service I haven't looked at in ages. We recently updated some dlls that broke the windows service, so it needed to be re-tweaked. Every time I tried running the installer project I would get an error that would read:
Error 1001. An exception occurred during the Commit phase of the installation. This exception will be ignored and installation will continue. However, the application might not function correctly after installation is complete. --> Cannot start service [Service Name Here] on computer '.'. --> %1 is not a valid Win32 application
Which like most errors is pretty damn useless. 


Gotcha
After a lot of head scratching and googling I tried installing the service manually. Then it became painfully clear what the problem was. The output types of some of the libraries were set to the wrong types for debugging reasons. So I switched the output types of the libraries back to their respective types, the most important being the windows service project set as a "windows application" and the service installed this time without a hitch as intended.