Home All Groups Group Topic Archive Search About

Windows Service fails to Uninstall through custom setup deployment project.

Author
1 Sep 2006 9:13 AM
mpriem
Hi all,

I've created my first setup project for a custom windows service.
It installs correctly, but fails to uninstall the windows service.

It seems that when I choose uninstall the overridden
Uninstall(IDictionary mySavedState) method recieves a NULL value. (I
have just overridden the method for testing purposes).

Please NOTE that in my setup project I have added the 'primary output
of <project>' to all custom actions. The installerclass property is set
to true.

I use the following installer code in my service project:
---------------------------------------------------------------------------------------------------------------------------------------
using System;
using System.Collections;
using System.ComponentModel;
using System.Configuration.Install;

namespace RSP_MailboxCapacity
{
    [RunInstaller(true)]
    public class ProjectInstaller : System.Configuration.Install.Installer
    {
        private System.ServiceProcess.ServiceProcessInstaller
serviceProcessInstaller1;
        private System.ServiceProcess.ServiceInstaller serviceInstaller1;
        private System.ComponentModel.Container components = null;

        public ProjectInstaller()
        {
            InitializeComponent();
        }

        public override void Uninstall( IDictionary mySavedState )
        {
            if (mySavedState == null)
            {
                string strError = "Uninstallation Error !";
                EventLog objEventLog = new EventLog(strError);

            }
            else
            {
                base.Uninstall( mySavedState );
                string strError = "The Uninstall method has been  called";
                EventLog objEventLog = new EventLog(strError);
            }
        }

        protected override void Dispose( bool disposing )
        {
            if( disposing )
            {
                if(components != null)
                {
                    components.Dispose();
                }
            }
            base.Dispose( disposing );
        }


        private void InitializeComponent()
        {
            this.serviceProcessInstaller1 = new
System.ServiceProcess.ServiceProcessInstaller();
            this.serviceInstaller1 = new
System.ServiceProcess.ServiceInstaller();
            this.serviceProcessInstaller1.Account =
System.ServiceProcess.ServiceAccount.LocalSystem;
            this.serviceProcessInstaller1.Password = null;
            this.serviceProcessInstaller1.Username = null;
            this.serviceInstaller1.ServiceName = "RSP_MailboxCapacity";
            this.Installers.AddRange(new
System.Configuration.Install.Installer[] {
this.serviceProcessInstaller1,                              this.serviceInstaller1});

        }
    }
}

--------------------------------------------------------------------------------------------------------------------------------------

Can anyone provide me some directions?

Thanks in advance!

Kind Regards,

Mark Priem

AddThis Social Bookmark Button