Best way to update Application (without installer)
I have used 2 different methods of updating my programs.
Both the methods copies all the files from one directory into the application directory, overwriting old files. It then launches the program with the -updated parameter so the program can notify the user.
So the two different methods are these:
Code:
1. Generate a batch script that kills all processes named the same as my app.exe, then executes this line "move /Y tempdir\* applicationdir" and at last it launches the application again with the -update parameter so the program can delete the batch and the vb script since they are in the same folder as the application.
2. Generate a vbscript that runs that batchscript invisbly (so the user doesn't notice anything)
Code:
1. Pass the tempdir along with application dir and application name to AutoUpdate.exe
2. That program launches, terminates my app, then moves the files in the tempdir to the application dir, overwriting everything.
3. It then launches my app with the -updated parameter.
Which is the best/cleanest, or do you have a better method? :)
Re: Best way to update Application (without installer)
Re: Best way to update Application (without installer)
No that is just disgusting. If I wanted to use installer I would have gone with Setup Factory that I normally use. I don't like .msi installers at all.
I chose to make a separate application in the end and have started the coding on one now.
Re: Best way to update Application (without installer)
2 problems you are going to have doing it without the installer
1) Trust of a user
2) security permissions
best use the proper, industry standard, way of an installer or click once.
alternatively, if you must use your application then i guess a call to a webservice to get the file to be transferred and from that, let your application handle the logic - so if a file is needing to be downloaded (a newer version), go download it and replace the current application with it (remember, you cannot overwrite a file whilst it is in use)
Re: Best way to update Application (without installer)
hmm okay I have changed and will use an installer instead :)
But I will still use my newly coded separate program to download and run the file. So I have one question:
What is the best way to close my program if the user wants to update?
At the moment I am planning to to implement so it just kills the process of it (using the name). But is there a better way?
Re: Best way to update Application (without installer)
Dont just kill the process (unless you are using an external application). instead, exit gracefully using Application.Exit()
your bootlauncher/strapper app should be the one to do the updating. so yes, you could, in theory, Kill that process from the bootstrapper, then update the file and then let the bootstrapper start a new Process of the updated application, then finally exiting the bootstrapper itself.
Re: Best way to update Application (without installer)
Quote:
Originally Posted by
Techno
your bootlauncher/strapper app should be the one to do the updating. so yes, you could, in theory, Kill that process from the bootstrapper, then update the file and then let the bootstrapper start a new Process of the updated application, then finally exiting the bootstrapper itself.
Precisely what I though of. Is it an accepted method among real programmers?
Since the updatecheck is performed at the start of the program, if there are an update available it should take just a couple of seconds to notify the user (depending on the server-response time). So killing the app shouldn't destroy anything for the user.
Re: Best way to update Application (without installer)
true but it depends on your application and requirements in future. who knows what could be implemented at startup.
is it an acceptable method amoungst real programmers? Real programmers would let industry standard installers/clickonce handle it for them. thats why they were also developed in the first place :-)
but yes, this generally is what happens even using those installers. but to be honest, usually you would have to try and find an exposed entry point to allow "trusted" software to gain access so it can correctly shutdown the app, instead of killing the app so the whole logic and workflow of shutting down an app properly is executed (could be saving files or whatever)
maybe something to look for....
take a look at something like Thread signaling between applications
Re: Best way to update Application (without installer)
Quote:
Originally Posted by
Techno
true but it depends on your application and requirements in future. who knows what could be implemented at startup.
is it an acceptable method amoungst real programmers? Real programmers would let industry standard installers/clickonce handle it for them. thats why they were also developed in the first place :-)
but yes, this generally is what happens even using those installers. but to be honest, usually you would have to try and find an exposed entry point to allow "trusted" software to gain access so it can correctly shutdown the app, instead of killing the app so the whole logic and workflow of shutting down an app properly is executed (could be saving files or whatever)
maybe something to look for....
take a look at something like Thread signaling between applications
Woah that seems to be something quite advanced (read a little bit about it). :rolleyes:
As I mentioned before, I will probably use Setup Factory. I suppose they should have some sort of safe shutdown mechanism since they support scripts :)
Will wait with the Thread thingy until I can have a teacher that can tell me about it (learning yourself on the net can be hard sometimes hehe).
Anyway, thanks for guiding me!