Link to home
Start Free TrialLog in
Avatar of thebigo
thebigoFlag for United States of America

asked on

Cannot uninstall Windows Service using MSI where ServiceName may be changed

Hello
I have created a Windows Service using vb in VS 2008 where I need to have multiple versions of the service running at the same time (refer attachment). This is optional.

I have changed the Installer to accept optional Context.Parameters for the Service Name and Display Name. If I use the command line installutil to install/uninstall everything works perfectly (e.g. installutil /NAME=myService /DISPLAYNAME="my Service" myService.exe).

I have also added a Setup Project as for some customers they won't need to have multiple instances and they aren't computer savvy so command lines are a bit too much for them. There are default values in the ProjectInstaller so that when running the MSI it uses the default parameters.

The problem occus if I try and uninstall via the MSI. The Service is uninstalled but I get the first error (below). Any further attempts to install via the MSI are met with 'Preparing to remove', the same error, then the Repair/Remove screen, then the second error below. The only way to run a clean install again is to delete the Registry Entry for the MSI in HKEY_CLASSES_ROOT\Installer\Products.

 I can use the installutil /u to successfully uninstall the service without specifying a NAME parameter (after using the MSI to install).

It appears that the problem is in the uninstall where no Context.Parameters are provided.

Can anyone help??
Regards
James

First error:
Error 1001. An exception occured while uninstalling. This exception will be ignored and the uninstall will continue. 
However, the application might not be fully uninstalled after the uninstall is complete. 
-> Service name contains invalid characters, is empty, or is too long (max lenght = 80).
Second error:
Error 1001. An exception occured while uninstalling. This exception will be ignored and the uninstall will continue. 
However, the application might not be fully uninstalled after the uninstall is complete. 
-> The specified service does not exist as an installed service.

Open in new window

ProjectInstaller.Designer.vb.txt
ASKER CERTIFIED SOLUTION
Avatar of Vadim Rapp
Vadim Rapp
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of thebigo

ASKER

Thanks for your response. I eventually found I had left some code in the uninstall Custom Action :(.

Regards
James