Programatically uninstall/install a service.

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • UJ

    Programatically uninstall/install a service.

    How could I have a program uninstall a service and then install a newer
    version of the same service? This assumes I've already got the files in the
    appropriate directory to be able to install the new version of the service.

    TIA - Jeff.


  • sloan

    #2
    Re: Programatically uninstall/install a service.


    Check this:


    Peter has a cool way to do it, you can probably pull the code from there.

    ...

    The aritcle is about msmq , but in the code is the windows service
    installer/uninstaller.



    "UJ" <fred@nowhere.c omwrote in message
    news:%23ZdQAIJR HHA.1180@TK2MSF TNGP05.phx.gbl. ..
    How could I have a program uninstall a service and then install a newer
    version of the same service? This assumes I've already got the files in
    the
    appropriate directory to be able to install the new version of the
    service.
    >
    TIA - Jeff.
    >
    >

    Comment

    • Ignacio Machin \( .NET/ C# MVP \)

      #3
      Re: Programatically uninstall/install a service.

      Hi,


      "UJ" <fred@nowhere.c omwrote in message
      news:%23ZdQAIJR HHA.1180@TK2MSF TNGP05.phx.gbl. ..
      | How could I have a program uninstall a service and then install a newer
      | version of the same service? This assumes I've already got the files in
      the
      | appropriate directory to be able to install the new version of the
      service.

      There is an option tin the setup project template where you can check for a
      previous version and just install the new over it. Did you try it?


      --
      Ignacio Machin
      machin AT laceupsolutions com


      Comment

      • UJ

        #4
        Re: Programatically uninstall/install a service.

        Thanks but I need to do it programmaticall y. I have a program that is going
        to check for updates on our server and if there is a newer version it will
        download it, uninstall the current service and replace it with the new one.

        "Ignacio Machin ( .NET/ C# MVP )" <machin TA laceupsolutions .comwrote in
        message news:%23WgjMrKR HHA.1908@TK2MSF TNGP05.phx.gbl. ..
        Hi,
        >
        >
        "UJ" <fred@nowhere.c omwrote in message
        news:%23ZdQAIJR HHA.1180@TK2MSF TNGP05.phx.gbl. ..
        | How could I have a program uninstall a service and then install a newer
        | version of the same service? This assumes I've already got the files in
        the
        | appropriate directory to be able to install the new version of the
        service.
        >
        There is an option tin the setup project template where you can check for
        a
        previous version and just install the new over it. Did you try it?
        >
        >
        --
        Ignacio Machin
        machin AT laceupsolutions com
        >
        >

        Comment

        • Ignacio Machin \( .NET/ C# MVP \)

          #5
          Re: Programatically uninstall/install a service.

          Hi,

          "UJ" <fred@nowhere.c omwrote in message
          news:OJL73oTRHH A.3996@TK2MSFTN GP04.phx.gbl...
          | Thanks but I need to do it programmaticall y. I have a program that is
          going
          | to check for updates on our server and if there is a newer version it will
          | download it, uninstall the current service and replace it with the new
          one.

          I know there is a way of doing that in code, just that I do not know it,
          take a look in the archives.

          A workaround would be:
          1- stop the service
          2- copy the new files over the old one
          3- restart the service


          All the above actions are easily implemented in code


          --
          Ignacio Machin
          machin AT laceupsolutions com


          Comment

          Working...