george4986 asked:
hi SA
I have developed a similar application for update exe versions in client machines.we are using windows forms along with web service for connecting live (Database)DB.
.On each installation i save the version in client machine along with msi file.when a new version is released ,we update the version value in a table on live DB and place new msi file on hosting machine(3 tier application).each login time application exe check the live table version with clients version and give user an info msg about new version .User needs to run updater exe for updation.while running updater application it uninstalls previous version using the old msi version stored in client machine ( string arg = "/x \"C:\\OldApplication.msi\"/qn";) , download & installs new exe( string arg1 = "/i \"C:\\Application.msi\"/qn";).updator application is working. Thanks SA for ur patience in reading this message . Is it possible to make it a single application instead of using Two exe's (updator, application) in my case?.If i have done it in a wrong way , plz enlighten me.Waiting for ur valuable suggestions.Thanks in Advance
------------------George--------------
I would not recommend it.
Let's see. In principle, this is possible. But…
First of all, updater will replace some PE files. But it is impossible to remove a PE file when it is loaded for execution. Therefore, you would need to save some temporary updated application, terminate your application, run that temporary updater, and then restart your application. Then you will need to remove that temporary updater.
Worse thing is: it is typical that installation process needs privilege elevation, while the application is typically run without elevation. So, in this case you would need to terminate the application, restart it "As Administrator", do the update and then start application again. As you see, it would defeat the purpose of merging of application and installer/updater.
Also, don't you break the integrity of your system's installation database? It's easy to modify something which is not reflected in this database, but it would break the users' ability to retrace their steps.
Really, it's much better to keep the application and its installer/updater separately.
Consider different thing: not using installation at all. This is called "portable" version of the application these days. At last, even Microsoft started to encourage such things. If you just copy your application to some directory, it can be used immediately. Of course, you if need to update the registry or something like that, you will still need the installation. Another option is to give the user the choice between "portable" and "installation" versions. This is just something to review critically.
—SA