.NET Winforms 应用程序是否有自动升级的标准方法?

发布于 2024-08-10 23:47:05 字数 153 浏览 6 评论 0原文

如果您有一个安装在大量机器上的Winforms应用程序,是否有实现自动升级功能的标准方法?

例如,每次启动时,它都会检查网站或网络服务,如果有可用的新版本,它会下载并安装它?

我可以弄清楚如何推出我自己的版本,但我想知道是否已经有任何框架可以帮助解决这个问题。

If you have a Winforms app that is installed on a large number of machines, is there a standard way of implementing an automatic upgrade function?

e.g. Each time it is started, it checks a web site or web service and if there is a new version available, it downloads and installs it?

I could figure out how to roll my own version of this, but I'm wondering if there are any frameworks already in place to help with this.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

素染倾城色 2024-08-17 23:47:05

+1 对 ClickOnce 的答案,但我也想对此发表一些评论:

通常,当有人第一次开始查看 ClickOnce 时,他们会发现它为他们的应用程序允许执行的操作添加了许多新的限制。他们几乎总是至少违反其中一项,然后回来声明 ClickOnce 对他们不起作用,因为 x、y 和 z 不再起作用。

预计这种情况将再次出现,我想花点时间解释这些限制的基本原理,以及为什么您可能想要仔细研究应用程序的运行方式,而不是编写自己的更新系统或采用替代方案。

这里的关键是查看 ClickOnce 应用程序的主要用例。该用例主要是企业工作站,您希望在其中部署一个真正的 winforms 业务线应用程序,该应用程序应始终保持最新状态,但在任何情况下,用户都不应该拥有对自己计算机的管理员访问权限。由于您谈论的是“安装在大量计算机上的应用程序”,我认为您很可能属于该类别。

看看这个用例,最后一点尤其是杀手锏。最后,ClickOnce 应用程序的大多数小限制都需要以下其中一项:

  1. 运行时的管理员访问权限,甚至是短暂的
  2. 更新时的管理员访问权限

有时,您是否需要该访问权限或为什么需要该访问权限并不明显,但最终通常都是这样。想要向系统注册 dll 或更新 Program Files 文件夹中的文件?默认情况下,这需要管理员访问权限。需要安装或更新 Windows 服务?管理员访问权限。想要运行第三方组件的 msi 安装程序吗?您需要管理员权限才能运行 msi。想监听 TCP 端口吗?你明白了。

最终,您的目标是让仅具有标准权限的用户仍然能够自动更新您的应用......甚至是透明的。否则,您需要额外的 IT 人员参与每项工作部署。即使您的计划是针对广大公众的,这也是一个好主意。它将帮助您避免某种类型的支持问题。使用替代部署系统不会改变这一点。这些系统通常只针对消费者计算机,大多数用户无论如何都以管理员身份运行,因此不太提前了解这些问题。

+1 on the ClickOnce answer, but I wanted to make a few comments on that as well:

Normally, when someone first starts out looking at ClickOnce they discover that it adds a number of new restrictions to things that their app is allowed to do. They nearly always violate at least one of these and come back declaring that ClickOnce doesn't work for them because x,y, and z won't work anymore.

Anticipating this will once again be the case, I want to take a moment to explain a rationale for these restrictions and why you might want to take a closer look at the way your app functions rather than write your own update system or go with an alternative.

The key thing here is to look at the primary use case for ClickOnce apps. That use case is mainly corporate workstations, where you want to deploy a real winforms line of business app that should always be up to date, but under no circumstances should users ever have administrator access to their own machine. Since you're talking about an "app that is installed on a large number of machines", I think it's likely you're in that category.

Looking at this use case, the last point especially is killer. In the end, most of the little restrictions on ClickOnce apps are things that would require one of the following:

  1. Administrator access at run time, even briefly
  2. Administrator access at update time

Sometimes it's not obvious that you need that access or why you need that access, but in the end that's usually what it comes down to. Want to register a dll with the system or update a file in the Program Files folder? That requires administrator access by default. Need to install or update a windows service? Administrator access. Want to run an msi installer for a third party component? You need Admin privileges to run msi's. Want to listen on a tcp port? You get the idea.

In the end, your goal is to make it so that even users with only standard privileges will still be able to update your app automatically... even transparently. Otherwise, you need extra IT staff involved with every deployment. This is a good idea even if your program is for the public at large; it will help you avoid a certain class of support issue. Going with an alternative deployment system won't change this. Those systems are just typically targeted at consumer machines where most users run as administrator anyway and so are less up front about the issues.

自由如风 2024-08-17 23:47:05

您可能想尝试一下 ClickOnce,我认为这是可能的。

You may want to try out ClickOnce, I think it's possible with that.

套路撩心 2024-08-17 23:47:05

AppLife 更新物有所值。

AppLife Update is worth every cent it costs.

窗影残 2024-08-17 23:47:05

我最终使用了开源“Conversive Sharp AutoUpdater”,网址为

http://csautoupdater.sourceforge.net/

Sharp AutoUpdater 是一个 C# 组件,它将自动更新您的 .NET 应用程序。 AutoUpdater 组件使用 XML 配置文件来检测是否有新版本的软件,然后下载、解压缩并安装新文件。

它相当简单 - 它下载一个 zip 并将其解压缩到已安装的应用程序 - 但它运行良好并且比我自己编写更容易。如果用户没有对其程序文件文件夹的管理员访问权限,我认为它不能很好地处理事情。

I eventually used the Open Source 'Conversive Sharp AutoUpdater' at

http://csautoupdater.sourceforge.net/

Sharp AutoUpdater is a C# component that will automatically update your .NET application. Using XML configuration files, the AutoUpdater component detects if there is a new version of the software, downloads, unzips, and installs the new files.

Its fairly simpe - it downloads a zip and unzips it over the installed app - but it works well and was easier than writing my own. I don't think it handles things very well if users dont have admin access to their program files folder.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文