Search code examples
windows-servicesvb.net-2010visual-studio-setup-proje

windows service uninstallation


I created a simple windows service. And added setup project to this solution. I could build service and setup project successfully. Also after build I could use the MSI file created successfully. I could install windows service successfully and could achiev the functionality.

But now I want to uninstall the service and from Add/Remove programs I am removing this service. The service is uninstalled from Add/Remove programs. But still I can see the service in the list of Service. Do I need to add anything while creating the setup for windows service?


Solution

  • When you create a setup project you can set external commands to run before installation:

    1. Right click the SetupProject from visual studio and select "custom actions" from the view.
    2. You will find these custom actions: install, commit, rollback and uninstall.
    3. Right click on each of these actions one after the other and add a custom action.
    4. After doing so you will find a select item in project window.
    5. In the window, select Application folder in the dropdown. This will list the primary output from windows service, select it and click ok.
    6. Save and build the setup project.