There are areas for improvement that weren't required for this project, such as:
Renaming running process to ' F:\Dropbox\Red Cell Innovation\Code Project\Updater\Updater\\4\'.Ĭopy Code You are running version 2 of this console application. The main thread is going to wait for a keypress.įetching ' RedCell.UI.'. Initializing using file ' F:\Dropbox\Red Cell Innovation\Code Project\Updater\Updater\\4\update.xml'. Using the CodeĪdd a reference to to your project.Ĭopy Code You are running version 1 of this console application.
To update the application we copy everything in the work directory to the application directory, and then delete the work directory.įinally, the application is spawned as a new Process, and the current process is closed. If it is not being replaced, no harm done.
The file lock has been moved to the backup file, so if a payload contains a replacement, it will overwrite.
exe.bak and then we copy that file back to. However, Windows does (reason unknown) allow a running executable to be renamed! First we rename the application to. This is enforced by the operating system. How do we solve the chicken and egg problem? One of the payloads might contain a replacement for your application's executable itself, but it can't be overwritten while it is running. It also copies the remote manifest to the working directory, because it will become the new local manifest. Update creates a work directory, downloads each of the payloads specified in the remote manifest, and unzips each of them.
If the remote version is newer, the Update method is executed. Meanwhile, the application continues to run without interruption in the foreground.Ĭheck fetches the remote manifest, checks the SecurityToken for tampering, and compares the version of the remote manifest to that of the local one. When this occurs, a new thread is created that executes the Check method. The updater creates a that ticks at the interval set by the manifest. foo\bar.exe will be put in the application's foo directory. At present, payloads must be ZIP files and their directory structure should be relative to the application's root. The format for the local and remote manifests is the same.