VB.NET: Updating executable if it is in use..

  • Thread starter Thread starter Robert Brown
  • Start date Start date
R

Robert Brown

Hi All..

I have written an application that clients of ours use at their
business. The application checks our main FTP server for new reports
and then downloads them. The download process also downloads NEW
versions of the executable they are running.

What I want to do is have the program that has just downloaded the
reports and executable to somehow be able to update itself. That is,
copy the new exe and overwrite the old one.

I was thinking maybe that on shutdown of the program, if there was a
new EXE available, a BAT file could be written to copy the new version
over. The BAT file would be run on closing of the application.

I know this isn't the best, but are there any other ideas? I don't
want to run an installer or such...

Thanks,
Robert
 
There's no need to run an installer unless you have other actions to perform
(like adding registry entries).
For a sample of what you can do, go the MSDN site and search for the Updater
Application Block.

For something more complicated, you can create a host executable that
creates an appDomain, and loads your program into the AppDomain to run from
there. The host code can at any point unload the AppDomain, replace the
files, and restart the AppDomain. This is essencially what IIS does.

-Rob Teixeira [MVP]
 
Thanks for the replies..

I wasn't thinking about this way, but it might be the exact solution I am after.

Thanks,
Robert
 
Back
Top