Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
158 views
in Technique[技术] by (71.8m points)

Free solution for automatic updates with a .NET/C# app?

From searching I can see this has been asked time and time again, but not adequately enough, so here goes. I'm a hobbyist developer with no budget. A program I've been developing has been in need of regular bugfixes, and me and users are getting tired of having to manually update.

Me, because my current solution of updating a text file through FTP and my download links on the website, and then hoping users will see the "there's an update message", and finally getting them to then be bothered to manually download the update, well quite frankly, is abysmal.

Users, because, well, "Are you ever going to implement auto-update?" "Will there ever be an auto-update feature?" And if I happen to screw up the update process, pitchforks start arriving.

Over the past I have looked into:

  • WinSparkle - No in-app updates, and the DLL is 500 KB. My current solution is a few KBs in the executable and has no in-app updates.
  • .NET Application Update Component - Unfortunately I can't comprehend the documentation.
  • Eduardo Olivera's AutoUpdate - This doesn't appear to support anything other than working with files that aren't in use.
  • wyUpdate - wyBuild isn't free, and while the wyUpdate specification is available, it's simply too complex and time-consuming to go through.
  • AppLife Update - Ditto the last sentence.
  • ClickOnce - Workarounds for implementing launching on startup are massive, horrendous and not worth it for such a simple feature. Publishing is a pain; manual FTP and replace of all files is required for servers without FrontPage Extensions.

It's quite disappointing that the situation on Windows is like this when you've got really nice and simple implementations for Mac OS X like Sparkle.

question from:https://stackoverflow.com/questions/4524147/free-solution-for-automatic-updates-with-a-net-c-app

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Implement it yourself! It will be fun. Create a separate application that only contains update logic i.e., fetch the files online, download them, replace local files, and show that visually to the user.

So your main application could check for updates, and if they exist it would prompt the user with the possibility to update. If the user wants to, it will run the update program, close itself (so the update can happen) and presto.

The only things you need are readily avaliable in C#, FTP access and IO.

Edit: I know it's not something terribly easy, but it's a perfect chance to learn:

  • How to (properly) download files, in an abstracted way that can be extended to ftp, http, etc.
  • How to (properly) do a simple task over many files - copying or overwriting them (this implies error handling).
  • Practice (because there's no "proper" way) to layer and encapsulate a piece of software.
  • How to deal with the OS/other software (antivirus/firewall/etc) not cooperating.

These are all things we all need to know well - If it takes some weeks to code an updater it means you were needing some weeks of learning. If you don't need to learn, time to hone your skills! If you don't know if you need, time to find out! :)

Note: I know I do need to learn better file and network I/O


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...