over write running .exe

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

    #1

    over write running .exe

    I am using FTP built in to my application to update the application and data
    from a server...

    What is the normal method folks use to over write the application while the
    program is active? What I am running into is that the FTP code will not over
    write the .exe while the application is running.

    Do any other types of application extension files have the same issue with
    not wanting to be updated while the application is running: .dll, etc.??
  • C-Services Holland b.v.

    #2
    Re: over write running .exe

    BobAchgill wrote:[color=blue]
    > I am using FTP built in to my application to update the application and data
    > from a server...
    >
    > What is the normal method folks use to over write the application while the
    > program is active? What I am running into is that the FTP code will not over
    > write the .exe while the application is running.
    >
    > Do any other types of application extension files have the same issue with
    > not wanting to be updated while the application is running: .dll, etc.??[/color]

    Impossible, you can't overwrite files that are in use (be it
    executables, dll or whatever). Maybe you could write a sort of
    monitoring program that will detect a new upload (to a specified
    directory), shut down the program, copy/move the new program and start
    the new version.


    --
    Rinze van Huizen
    C-Services Holland b.v

    Comment

    • Jay B. Harlow [MVP - Outlook]

      #3
      Re: over write running .exe

      Bob,
      Actually this is very much possible & actually quite easy in .NET. As Rinze
      suggests normally one cannot "overwrite files that are in use", however .NET
      has the ability to create a shadow copy of executables, such that you can
      replace the original executable with the new one. To create a shadow copy of
      an executable you set the shadow copy option when creating a new AppDomain,
      then load your executable in this second app domain. This implies that your
      app has a loader "stub" that creates the app domain & executes your actual
      program. Using a FileSystemWatch er you could have the AppDomain
      automatically restarted when a new version of the app is saved (However I
      would simply inform my user to exit & restart the app).

      http://msdn.microsoft.com/library/de...ClassTopic.asp



      In .NET 2.0 (VS 2005) using ClickOnce is one of the easiest ways to
      implement this app loader/updater.

      Alternatively (.NET 1.x VS 2003) you can look at the Updater Application
      Block:

      http://msdn.microsoft.com/library/de.../updaterv2.asp

      --
      Hope this helps
      Jay [MVP - Outlook]
      ..NET Application Architect, Enthusiast, & Evangelist
      T.S. Bradley - http://www.tsbradley.net


      "BobAchgill " <BobAchgill@dis cussions.micros oft.com> wrote in message
      news:DA686017-2462-428B-815F-D6362AC44737@mi crosoft.com...
      |I am using FTP built in to my application to update the application and
      data
      | from a server...
      |
      | What is the normal method folks use to over write the application while
      the
      | program is active? What I am running into is that the FTP code will not
      over
      | write the .exe while the application is running.
      |
      | Do any other types of application extension files have the same issue with
      | not wanting to be updated while the application is running: .dll, etc.??


      Comment

      • C-Services Holland b.v.

        #4
        Re: over write running .exe

        Jay B. Harlow [MVP - Outlook] wrote:[color=blue]
        > Bob,
        > Actually this is very much possible & actually quite easy in .NET. As Rinze
        > suggests normally one cannot "overwrite files that are in use", however .NET
        > has the ability to create a shadow copy of executables, such that you can
        > replace the original executable with the new one. To create a shadow copy of
        > an executable you set the shadow copy option when creating a new AppDomain,
        > then load your executable in this second app domain. This implies that your
        > app has a loader "stub" that creates the app domain & executes your actual
        > program. Using a FileSystemWatch er you could have the AppDomain
        > automatically restarted when a new version of the app is saved (However I
        > would simply inform my user to exit & restart the app).
        >
        > http://msdn.microsoft.com/library/de...ClassTopic.asp
        >
        >
        >
        > In .NET 2.0 (VS 2005) using ClickOnce is one of the easiest ways to
        > implement this app loader/updater.
        >
        > Alternatively (.NET 1.x VS 2003) you can look at the Updater Application
        > Block:
        >
        > http://msdn.microsoft.com/library/de.../updaterv2.asp
        >[/color]

        Wow.. you learn something new every day :) I was quite unaware of this.


        --
        Rinze van Huizen
        C-Services Holland b.v

        Comment

        Working...