在线更新C#程序
您好,
如果已经问过这个问题,我很抱歉。我尝试过使用搜索功能,但找不到适合我情况的答案。
我有一个真正简单的 C# 表单应用程序,只有 1 个文件,一个 exe。 我目前通过 4shared 分发了此内容,人们可以随意下载。
然而,每次我对程序进行更改时,人们都必须从 4shared 下载新版本。
现在这不是一个理想的情况,我在创建升级方面是个菜鸟,但我希望的情况是程序查看我部署新版本的网站/ftp 服务器。
我正在我的程序中寻找一种方法来查看该网站/ftp 服务器上的文件并确定是否有可用的新版本。 如果网站/FTP 服务器中有可用的新版本,我希望该程序将自身更新到最新版本。
希望你们能帮助我解决这个问题,我希望我足够解释我的情况!
Greetings,
I'm sorry if this question has been asked already. I've tried using the search function but couldn't find any answer that suited my situation.
I have a real simple C# form application of only 1 file, a exe.
I distributed this currently by 4shared where people can download it as pleased.
However, every time I make changes to the program people will have to download the new version from 4shared.
Now this isn't a ideal situation and I'm a noob when it comes to creating upgrade but the situation I wish is that the program looks at a website / ftp server where I deploy a new version.
I'm looking for a way inside my program to look at the file on that website / ftp server and decide wether there's a new version available.
If there is a new version available in the website / ftp server I would like for the program to update itself to the newest version.
Hope you guys can help me out with this and I hope I explained my situation enough !
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
NetSparkle 是单击一次的不错替代方案,具有更多部署选项。 http://netsparkle.codeplex.com/
NetSparkle is a nice alternative to click-once with more deployment options. http://netsparkle.codeplex.com/
看看 ClickOnce。它会为你做这件事。
Have a look at ClickOnce. It will do this for you.
当我开发和发布此类应用程序时,我通常按以下方式进行:
我在 SOAP Web 服务中实现的逻辑基本上是一个函数:
Windows 窗体应用程序调用此方法(例如,在程序启动时从后台线程),将其当前程序集版本作为字符串传递给该函数。
WSDL 函数反过来根据最新的安装版本检查传递的版本(例如,存储在
web.config
中或从服务器上的setup.exe 中实时提取)。如果存在较新版本,则返回一个字符串,其中包含要下载的 URL;否则返回 NULL。当 WSDL 函数的调用者获得非 NULL 字符串时,它可以向用户显示一条消息,询问他是否要下载并安装可执行文件,然后简单地执行 URL(通过
Process.Start
)。When I'm developing and publishing such applications, I usually do it the following way:
The logic I implement in the SOAP web service is basically a single function:
The Windows Forms application calls this method (e.g. from a background thread upon program start), passing its current assembly version as a string to the function.
The WSDL function in turn checks the passed version against the newest setup version (e.g. being stored inside
web.config
or extracted live from the setup.exe on the server). If a newer version exists, it return a string with the URL to download from; otherwise it returns NULL.When the caller of the WSDL function gets a non-NULL string, it can show a message to the user, asking whether he wants to download and install the executable and then simply execute the URL (via
Process.Start
).WyUpdate 就是去这里的方法。我们已经使用它一年多了,取得了很好的效果(他们也有很好的支持)。
它实际上使用补丁来更新文件,这样当 5MB 的可执行文件只有很小的变化时,客户端只需下载千字节数量级的文件。
他们为 Windows Forms 或 WPF 提供了一个自动更新组件,该组件看起来不错并且运行良好。
您可以将更新文件托管在 FTP 服务器或普通网站上,而无需任何服务器端配置。
还有更多内容,最好的起点是他们的视频教程设置更新。
WyUpdate is the way to go here. We've been using it for over a year with great results (they have excellent support too).
It actually uses patches to update files so that when a 5MB executable only has a small change, the client only has to download a file in the order of kilobytes.
They supply an automatic update component for either Windows Forms or WPF that looks nice and works great.
You can host the update files on either an FTP server or a normal website without any server-side configuration.
There's plenty more to it, and the best place to start is with their video tutorial of how to set up an update.
这是我编写的一个开源库,旨在满足我们对 WinForms 和 WPF 应用程序的特定需求。总的想法是以尽可能最低的开销获得最大的灵活性。您所要做的就是创建一个更新源并从您的应用程序引用该库。
因此,集成非常简单,并且该库几乎可以为您完成所有操作,包括同步操作。它也非常灵活,可以让您确定要执行哪些任务以及在什么条件下执行 - 您可以设置规则(或使用一些已有的规则)。最后一点是对任何更新源(Web、BitTorrent 等)和任何提要格式的支持 - 无论未实现的内容,您都可以自己编写。
还支持冷更新(需要重新启动应用程序),并且会自动完成,除非为任务指定“热插拔”。
这一切都归结为一个 DLL,大小不到 70kb。
更多详细信息请访问 http://www .code972.com/blog/2010/08/nappupdate-application-auto-update-framework-for-dotnet/
代码位于 http://github.com/synhershko/NAppUpdate (根据 Apache 2.0 许可证授权)
我计划在有更多时间时对其进行更多扩展,但说实话,您应该能够快速自行增强它目前不支持的任何内容。
Here's an open-source library I wrote to address specific needs we had for WinForms and WPF apps. The general idea is to have the greatest flexibility, at the lowest overhead possible. All you'll have to do is create an update feed and reference the library from your app.
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 (or use some that are there already). 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 for yourself.
Cold updates (requiring an application restart) is 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)
I plan on extending it more when I'll get some more time, but honestly you should be able to quickly enhance it yourself for whatever it currently doesn't support.