The other day, I renamed some of my subversion working folders. Unfortunately, one of the folders that I renamed actually included a service that I had registered via installutil.exe on my local machine.
There is a problem with installutil.exe which means that this could be an unrecoverable Catch-22 situation. Here's why:
- You cannot uninstall it. If you try to uninstall it with installutil /u and point to your service (e.g. "uninstall /u DDK.ProjectName.MyNotificationServiceName", it cannot find the file will and give a "Exception occurred while initializing the installation: System.IO.FileNotFoundException: Could not load file or assembly '[Full Path To My File]' or one of its dependencies. The system cannot find the file specified.."
- You cannot install the exe to a different location with installutil because the service is already installed. If you do try to install it with a new path, you will just get the error "An exception occurred during the Install phase.System.ComponentModel.Win32Exception: The specified service already exists".
So to install a service with the same at the new location, I would have to:
- Copy the old file back to the original Windows Service Location location (or restore it from a backup) and run installutil /u on it. If I don't have the file anymore, I would not be able to do this.
- OR Remove the registry entry for the service.
So when you don't have access to the file/drive you originally installed a service to, you can fix this unrecoverable (from the perspective of installutil) situation by either:
- Opening regedit
- Going to HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services
- Removing the old registry entry for your service.
Running "sc" from a command prompt - see screenshot below for parameters: