I’ve created an installer using a Visual Studio 2008 deployment project where I install and uninstall a Windows service using a custom action and run into this problem when reinstalling the program.
Error 1001. The specified service has been marked for deletion
Installation Incomplete: The installer interrupted before JTB FlexReport Core could be installed. You need to restart the installer to try again. Click "Close" to exit.
Restarting Windows helps but I wanted to avoid that.
I tried to use sc delete but that didn’t work. I found a tip that services.msc should be closed but I did not have it running. I tried to manually tweak the registry HKLM\SYSTEM\CurrentControlSet\Services but it did not help either.
It took a while to identify the problem but the solution was easy. Close or exit from Sysinternals Process Explorer and run the setup again. For some reason Process Explorer is locking the service process and causing this problem.