What's the best way for a .NET winforms application to update itself without using ClickOnce?

前端 未结 9 2413
孤独总比滥情好
孤独总比滥情好 2020-12-23 17:29

For technical reasons, I can\'t use ClickOnce to auto-update my .NET application and its assemblies. What is the best way to handle auto-updating in .NET?

9条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-23 18:09

    On a project a long time ago, using .NET Compact Framework 1.0, I wrote an auto-updating application. We used SqlCE's CAB deployment feature to get the files onto the device (you would use Sync Framework now), and we had a separate exe that did the unpacking of the CAB, and updating the files.

    An update would go like this: the user would be prompted to update, click a button and drop out of the UI application. The updater exe would take over, get the cab file from the server, backup the current dlls and unpack the cab file with wceload. The UI would then be restarted, and if it failed, the update would be rolled back. This is still an interesting scenario on compact devices, but there are better tools now than just sqlce.

    I would certainly look at updater application block and sync framework to implement this if clickonce is not an option. But I'm guessing you'll still need a separate executable because the dlls you want to overwrite are probably file locked while in use by an exe, like one of the previous answers already said.

提交回复
热议问题