Installing a service through code.

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

    #1

    Installing a service through code.

    I have a situation where I want to upgrade/add a service on a machine
    automatically. If the service is already there, I need to remove it. I then
    need to install a new version of the service. How do I go about this in
    code?

    TIA - Jeff.


  • Peter Bromberg [C# MVP]

    #2
    RE: Installing a service through code.

    Unless you want to take another approach, you would normailly write an MSI
    Windows installer (Deployment Project) and set the "Remove Previous Versions"
    property to true.
    Your installer would also need to have some custom commands to stop and
    uninstall the previous version, and install and start the new version. Some
    study will be required, there are a few articles out there that will help.
    Peter
    --
    Co-founder, Eggheadcafe.com developer portal:

    UnBlog:





    "UJ" wrote:
    [color=blue]
    > I have a situation where I want to upgrade/add a service on a machine
    > automatically. If the service is already there, I need to remove it. I then
    > need to install a new version of the service. How do I go about this in
    > code?
    >
    > TIA - Jeff.
    >
    >
    >[/color]

    Comment

    • UJ

      #3
      Re: Installing a service through code.

      Thanks Peter. But I need to have it done silently behind the scenes. A
      program will figure out there's a new version and run without human
      intervention.

      Jeff.

      "Peter Bromberg [C# MVP]" <pbromberg@yaho o.nospammin.com > wrote in message
      news:06B79E38-E618-4AE2-B2CE-7AEBAD79DDB6@mi crosoft.com...[color=blue]
      > Unless you want to take another approach, you would normailly write an MSI
      > Windows installer (Deployment Project) and set the "Remove Previous
      > Versions"
      > property to true.
      > Your installer would also need to have some custom commands to stop and
      > uninstall the previous version, and install and start the new version.
      > Some
      > study will be required, there are a few articles out there that will help.
      > Peter
      > --
      > Co-founder, Eggheadcafe.com developer portal:
      > http://www.eggheadcafe.com
      > UnBlog:
      > http://petesbloggerama.blogspot.com
      >
      >
      >
      >
      > "UJ" wrote:
      >[color=green]
      >> I have a situation where I want to upgrade/add a service on a machine
      >> automatically. If the service is already there, I need to remove it. I
      >> then
      >> need to install a new version of the service. How do I go about this in
      >> code?
      >>
      >> TIA - Jeff.
      >>
      >>
      >>[/color][/color]


      Comment

      • Chris Dunaway

        #4
        Re: Installing a service through code.

        Check this link out. I posted some code which I use to install
        windows service programatically . You should be able to adapt it to
        your purposes. I think it is in VB but should be fairly straight
        forward to convert.

        http://tinyurl.com/7382d

        Comment

        • Peter Bromberg [C# MVP]

          #5
          Re: Installing a service through code.

          In that case, you will probably want to study the AppUpdater Application Block.
          The basic concept is, a process will check a webservice periodically to see
          if there is a new version. If so, it will silently download and install it.
          Peter

          --
          Co-founder, Eggheadcafe.com developer portal:

          UnBlog:





          "UJ" wrote:
          [color=blue]
          > Thanks Peter. But I need to have it done silently behind the scenes. A
          > program will figure out there's a new version and run without human
          > intervention.
          >
          > Jeff.
          >
          > "Peter Bromberg [C# MVP]" <pbromberg@yaho o.nospammin.com > wrote in message
          > news:06B79E38-E618-4AE2-B2CE-7AEBAD79DDB6@mi crosoft.com...[color=green]
          > > Unless you want to take another approach, you would normailly write an MSI
          > > Windows installer (Deployment Project) and set the "Remove Previous
          > > Versions"
          > > property to true.
          > > Your installer would also need to have some custom commands to stop and
          > > uninstall the previous version, and install and start the new version.
          > > Some
          > > study will be required, there are a few articles out there that will help.
          > > Peter
          > > --
          > > Co-founder, Eggheadcafe.com developer portal:
          > > http://www.eggheadcafe.com
          > > UnBlog:
          > > http://petesbloggerama.blogspot.com
          > >
          > >
          > >
          > >
          > > "UJ" wrote:
          > >[color=darkred]
          > >> I have a situation where I want to upgrade/add a service on a machine
          > >> automatically. If the service is already there, I need to remove it. I
          > >> then
          > >> need to install a new version of the service. How do I go about this in
          > >> code?
          > >>
          > >> TIA - Jeff.
          > >>
          > >>
          > >>[/color][/color]
          >
          >
          >[/color]

          Comment

          • UJ

            #6
            Re: Installing a service through code.

            Well isn't that just a kick in the head. That's exactly what I was looking
            for.

            Thanks.

            "Peter Bromberg [C# MVP]" <pbromberg@yaho o.nospammin.com > wrote in message
            news:BE5055A6-16E5-41D1-9581-B5FE32200499@mi crosoft.com...[color=blue]
            > In that case, you will probably want to study the AppUpdater Application
            > Block.
            > The basic concept is, a process will check a webservice periodically to
            > see
            > if there is a new version. If so, it will silently download and install
            > it.
            > Peter
            >
            > --
            > Co-founder, Eggheadcafe.com developer portal:
            > http://www.eggheadcafe.com
            > UnBlog:
            > http://petesbloggerama.blogspot.com
            >
            >
            >
            >
            > "UJ" wrote:
            >[color=green]
            >> Thanks Peter. But I need to have it done silently behind the scenes. A
            >> program will figure out there's a new version and run without human
            >> intervention.
            >>
            >> Jeff.
            >>
            >> "Peter Bromberg [C# MVP]" <pbromberg@yaho o.nospammin.com > wrote in
            >> message
            >> news:06B79E38-E618-4AE2-B2CE-7AEBAD79DDB6@mi crosoft.com...[color=darkred]
            >> > Unless you want to take another approach, you would normailly write an
            >> > MSI
            >> > Windows installer (Deployment Project) and set the "Remove Previous
            >> > Versions"
            >> > property to true.
            >> > Your installer would also need to have some custom commands to stop and
            >> > uninstall the previous version, and install and start the new version.
            >> > Some
            >> > study will be required, there are a few articles out there that will
            >> > help.
            >> > Peter
            >> > --
            >> > Co-founder, Eggheadcafe.com developer portal:
            >> > http://www.eggheadcafe.com
            >> > UnBlog:
            >> > http://petesbloggerama.blogspot.com
            >> >
            >> >
            >> >
            >> >
            >> > "UJ" wrote:
            >> >
            >> >> I have a situation where I want to upgrade/add a service on a machine
            >> >> automatically. If the service is already there, I need to remove it. I
            >> >> then
            >> >> need to install a new version of the service. How do I go about this
            >> >> in
            >> >> code?
            >> >>
            >> >> TIA - Jeff.
            >> >>
            >> >>
            >> >>[/color]
            >>
            >>
            >>[/color][/color]


            Comment

            Working...