开发者

c# application updater run from memory?

I know that I can have Updater.exe & MainProgram.exe but I want to keep my release in one EXE file.

Can I run updater.exe from memory (updater.exe will be included in mainprogram.exe) and then shut down mainprogram.exe and keep the updater working (it will update mainpro开发者_如何学Pythongram.exe) in new thread? Is it possible?

Or is there any other solution where I can just keep one single released EXE file?


Include the updater.exe as a resource in your app and then save it to a temporary file and run that.


Never did the stuff like this, honestly, but can share a couple of ideas on subject:

  1. Use a CodeDome to compile an assembly Updater.exe at runtime and execute it (don't like this one)
  2. If you check new software version/update from some location, why do not download first from the same location Updater.exe too ?

Updater.exe have to be very lightweight + it gives you opportunity in a moment you decide to change updater (for million reasons you could have) you just recompile it and put it's binary into shared folder, without affecting main setup.

I, personally, don't like an idea merging updater with main setup.

Hope this helps.

Regards.


First of all, lose the idea of meddling with embedding and updating "exes" in memory.

Try this: From your main application check the update server if there's a newer version of the program available. If there is, download the new exe, download or create a simple batch file that deletes the current exe and renames the new one, then fork and execute the batch file, and exit. The batch file will wait a moment, rename the exe, maybe launch the new one, and delete itself.


I have seen this solved 2 ways, although I am sure there's plenty more

  1. Using ClickOnce's feature to auto-update
  2. Using a batch file that is started but waits for the user to press OK,during the time it prompts for OK, the real program closes down in the background. Then the batch finishes the update and restarts the application.

Both worked for us, but I was never totally satisfied by #2 since it required the user to press a key. Perhaps you could add in a delay instead.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜