0

For example I have a client-server application, this application often gets updated (it's an exe file). If I download the update on the server machine then the same update should be transfered to the client machines, or vice-versa.

At the moment the update is downloaded on all machines individually. My idea is downloading the update should be done only on the server and I'm planning to make an option in the client to copy the *.exe file (update) directly from the server and paste it on the installation path.

How can I make this happen?

NOTE : the update is a self extracting file.

tshepang
  • 12,111
  • 21
  • 91
  • 136
  • specify your reason for the `DownVote` so that i can improve my _question_ –  Jul 22 '14 at 12:12
  • You can't update a running executable with a new copy of itself. Have a look at `My Project` and the `Publish` tab. There are also awkward ways of doing this using a second executable to do the copying; i.e. if server app is newer, run update exe and quit. Update exe does the copying and then restarts the newly copied first exe. – Grim Jul 22 '14 at 12:23
  • 1
    The down vote was likely because of your unnecessary formatting, and because you question appears as a request for code (you don't show or tell what you have tried). – slugster Jul 22 '14 at 12:25
  • while click on update the application will close and then an external updater application start to download once the download is complete it will extract the `exe` to the application folder –  Jul 22 '14 at 12:25
  • @slugster as you can see am just a beginner on SO if it is poorly formatted then anybody can [edit](http://stackoverflow.com/posts/24886925/edit) it right ?? –  Jul 22 '14 at 12:27
  • That is correct - but that still doesn't stop people from down voting it. You can also re-edit it yourself. – slugster Jul 22 '14 at 12:31

2 Answers2

1

You have to write an application that will be split into different parts :

  • Detect file change either on the client or server machine
  • Perform the copy of the exe file to server or other clients.

In all cases you can't tell an exe file to update it self.

Thomas Carlton
  • 5,344
  • 10
  • 63
  • 126
1

There is already a technology for achieving this called ClickOnce. The client application can be "published" to a share that is accessible to all the clients, then each time the client is executed a version check is done - if a later version is detected on the share then it is downloaded before execution continues.

You can read more about this here: ClickOnce Security and Deployment. Creating a ClickOnce package and publishing it is a feature already built into Visual Studio, so you do not need to write any code.

slugster
  • 49,403
  • 14
  • 95
  • 145