How to update the “updater”? (C#)

2020-07-18 04:16发布

I have a program that consists of two programs: Updater and WorkMaker. Whenever there is an update for WorkMaker - Updater kills it, downloads updates, and runs it again. But say I came up with new Updater program. How do I update it? Through WorkMaker? Through the third program? Thanks.

4条回答
老娘就宠你
2楼-- · 2020-07-18 04:22

I'm not sure how far along your application's architecture is, but as a total replacement for "Updater" have you considered using ClickOnce for managing the deployment of "WorkMaker"?

It will ensure that it's running the latest patch on startup. If the application is a long running one, then you can also manually kick off upgrades too.

查看更多
够拽才男人
3楼-- · 2020-07-18 04:26

I use a similar setup to run our msi and msp files when necessary. The solution consists of a small executable that loads a worker DLL in a second AppDomain using Shadow Copying. The executable is so simple that I've never needed to change it. However, I can now easily patch my worker DLL as I please since it's not locked in its original location on disk.

查看更多
霸刀☆藐视天下
4楼-- · 2020-07-18 04:30

The simplest solution IMHO is:

  • At the moment was requested update MainProgram downloads Updater, along with updates, after launches Updater.

  • Updater closes MainProgram, makes update and relaunch MainProgram, or simply exit.

In this way you have flexible way to update your program (MainProgram), but also Updater itself, when its required.

Hope this helps.

查看更多
狗以群分
5楼-- · 2020-07-18 04:40

You could have your updater dowload the update, run it with some parameters and have the new updater delete the original.

You could also have WorkMaker act as the updater for your Updater program.

查看更多
登录 后发表回答