Self update

  • Thread starter Thread starter Peter Morris [Droopy eyes software]
  • Start date Start date
P

Peter Morris [Droopy eyes software]

My app does this

1) User chooses "Sync with server"
2) XML is generated from my DB
3) App connects to an FTP server and uploads XML
4) ......
5) DB is dropped + recreated
6) New XML is downloaded + imported

What I would like to happen at step 4 is for a remote text file to be
downloaded and the version number compared to the current app. If it is
different then I would like to have my app upgrade itself. It is important
that any upgrades happen before step 5 because the XML downloaded (and DB
structure to create) will be in a new format.

I suppose I could either
A) Download a CAB file
Problem: I need the app to install onto an external memory card, not the
main one (See my other post "Installation project")

B) Download a ZIP file containing all the program files I need
Problem: I don't suppose I can replace the DLLs because my app currently has
them loaded

So how can I get this app to autoupdate itself + restart at step 4?


Thanks

Pete
 
You need a bootstrap program. Pull down the updates with a different
filename, then launch the bootstrap and close yourself. The bootstrap then
renames the existing app to an old name (rename in case you get a failure
during the process so you have the old one), rename the new to the correct
name, delete the old name, launch the app again and exit the bootstrap.
 
Sounds good, I just need a sleep in the bootstrap to give the app time to
close properly and that should work.

Thanks!

Pete
 
If you have the process handle for the application, you can do a
WaitForSingleObject() on it and that call will return when the process has
exited. You have to P/Invoke WFSO, of course...

Paul T.
 
Alternatively just try File.Delete until it works. :)

"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam DOT
com> wrote in message news:OjY%[email protected]...
 
Back
Top