Suggest a method for auto-updating my C# program [duplicate]

只谈情不闲聊 提交于 2019-11-27 01:08:14

问题


This question already has an answer here:

  • Automatic update a Windows application 5 answers

I need to keep a program I've written up to date, this will happen frequently over the next year or so, this will need to be done over the Internet. Where would you suggest I start, are there any common techniques? Any suggestions welcome.

Thanks


回答1:


Fairly well is not good enough :)

NAppUpdate is an open-source library I wrote to address just this. The general idea is to have the greatest flexibility, at the lowest overhead possible.

So, integration is super-easy, and the library does pretty much everything for you, including synchronizing operations. It is also highly flexible, and lets you determine what tasks to execute and on what conditions - you set the rules. Last by not least is the support for any updates source (web, BitTorrent, etc) and any feed format - whatever is not implemented you can just write by yourself.

Cold updates (requiring an application restart) are also supported, and done automatically unless "hot-swap" is specified for the task.

This all boils down to one DLL, less than 70kb in size.

More details at http://www.code972.com/blog/2010/08/nappupdate-application-auto-update-framework-for-dotnet/

Code is at http://github.com/synhershko/NAppUpdate (Licensed under the Apache 2.0 license)




回答2:


ClickOnce is perfect for this sort of scenario.




回答3:


There is this great framework called NetSparkle and also this DotNetUpdater

I haven't used them yet but hope to do so very soon. You can try it out.




回答4:


ClickOnce is a good solution, but if you wish to have total control then you can roll-your-own. I would suggest polling a webservice to find if there are later versions available, downloading required files to a side-by-side directory, and using a launcher (or updating a shortcut) to automatically launch the latest version.

This is a little complicated, but caters for situations where the application may be running, and can therefore not be overwritten.



来源:https://stackoverflow.com/questions/555118/suggest-a-method-for-auto-updating-my-c-sharp-program

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!