Error in uninstalling the Windows Service

csharp India
  • 18 years ago

    I got the following error while executing the installutil/u MyFile.exe. Refer the steps below:
    ---------------------------------------------------------------------------------------------------------------------------    
       Affected parameters are:
         assemblypath = d:\test\filewatcher.exe
        logfile = d:\test\filewatcher.InstallLog
       An exception occurred during the uninstallation of the FileWatcher.SetupInstaller installer.
       System.NullReferenceException: Object reference not set to an instance of an object.
       An exception occurred 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.
       Removing EventLog source OFACFolderWatchService.
       Service OFACFolderWatchService is being removed from the system...
       Service OFACFolderWatchService was successfully removed from the system.




    Detailed Steps:



    I developed FileWatcher windows service using C# and created Microsoft Installer. Installation and Uninstallation was working fine.


    Later I customized the Microsoft Installer by adding one Installer class (SetupInstaller.cs) to my existing FileWatcher project.


    Added the Override method of base Class as:


       public override void Install(System.Collections.IDictionary  PassData)
           {
               //update the XML File
               string strAppPath = System.Reflection.Assembly.GetExecutingAssembly().Location;
               strAppPath = strAppPath.Substring(0,strAppPath.LastIndexOf("\")+1);
               string strXMLFile = strAppPath + "OFACTracker.xml";
               XmlDocument objXMLDocument = new XmlDocument();
               string strNodeValue = "";
               try
               {
                   objXMLDocument.Load(strXMLFile);


                   XmlNodeList objNodeList = objXMLDocument.GetElementsByTagName("InBox");
                   strNodeValue = strAppPath + "Inbox";
                   objNodeList.Item(0).FirstChild.Value = strNodeValue;
                   
                   
                   objXMLDocument.Save(strXMLFile);
               }
               catch(Exception)
               {
                   //Exception Handling
               }
           }
           


    Note:
       ProjectInstaller.cs already exist while creating the service. I didnt touch this installer class.



    Created Setup Package. Here I added Project group to an Application Folder of System Editor and Added custom Action to an Install Node.
    In this case Installation was working file (Service registered automatically). Before Unstallation, executed Installutil/u FileWatcher.exe and got the above


    error.

Post a reply

No one has replied yet! Why not be the first?

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Owning a computer without programming is like having a kitchen and using only the microwave oven” - Charles Petzold