Hello.
I have been creating a application that checks the application version and sees if it fits with the version from http://msbeditor.dumpen.dk/versioninfo.html
If it doesnt I use a webBrowser component to open a download link to http://msbeditor.dumpen.dk/msbEditor.rar
But this is not very practical because, the ones using my application have to download all files even though some of the files are not changed..
So I wanted to ask if you have an idea on how to make a auto updater in C#?
I was thinking of something like:
Check the application version with the online version (Allready done)
If it doesnt fit, then match all the files (last changed or file size or similar) in the rar file (from msbeditor.dumpen.dk) with the files in the application folder
If they are changed then download the changed files
Any ideas?
Loading
Posted Jul 4, 2008, 6:13 PM
Basically, you would store a manifest with all of the version numbers on a server location where it can be accessed. The updating application will look at the server using a WebClient with the proper NetworkCredentials and using the DownloadFile() method, will download the manifest. The manifest contains the names of all of the files and their versions available for the update, and the update application will look at its files names and versions, compare them to whats available, and compile a list of files it needs to download.
It will then request each file from the server using the WebClient object, creating "temp" versions of them, and create backups of the old files before doing any swapping. Once all of the files have been downloaded completely, it will shutdown the associated application being updated, delete the old libraries, swap in the new libraries with the "temp" extensions (removing the .temp extension in the process) and delete the backed up files and restart the application.
It sounds pretty simple in theory and it really is. I use alot of .dll's to allow flexible updating, but the thing is, my updater will grab any file you tell it to grab, and process it even if it doesnt have a version number. The manifest xml file is what tells the updater what to get basically.
The only real pain is making sure the version numbers of the new files are all correct. If you have alot of files, this can be a pretty tedious task and I recommend writing an application to syncronize the files with their respective versions. But even so, you still have to remember to increment the version number of the file manually. So you need to be careful and very detailed about doing it this way, otherwise some poor clients are going to be downloading the wrong libraries, or wont be downloading the necessary ones and this could very well leave them with defunct software!
Scott LyslePosted Jul 4, 2008, 5:37 PM
You may wish to consider using ClickOnce deployment with an updater function. There is an example of a ClickOnce project here: http://msdn.microsoft.com/en-us/library/01f4d4fc(VS.80).aspx
You might want to look that over and familiarize yourself with the updater function options.