简体   繁体   English

自动更新 c# 程序

[英]autoupdate c# program

Suppose i have a program.. how can i accomplish this?假设我有一个程序.. 我怎么能做到这一点?

i want the program to have an update feature.我希望该程序具有更新功能。 so its like,, when i posted a new version in the ftp server, the old program searches the ftp server and if theres a new version, it will download the new program and delete the old ones.就像,当我在 ftp 服务器上发布新版本时,旧程序搜索 ftp 服务器,如果有新版本,它将下载新程序并删除旧程序。

thank you谢谢你

PS: it can be the user presses the update button, then the program will download the contents to one temp directory, then deletes itself and transferring the new files to the current folder PS:也可以是用户按下更新按钮,程序会将内容下载到一个临时目录,然后自行删除并将新文件转移到当前文件夹

or it can be an auto update, like the program checks every 12 hours.或者它可以是自动更新,例如程序每 12 小时检查一次。

You can achieve this using ClickOnce .您可以使用ClickOnce实现此目的。

You could end up using a pre-executable that performs the update.您最终可能会使用执行更新的预可执行文件。 Starting the application not with the main exe, but with one that performs the update and then launches the main app.不是使用主 exe 启动应用程序,而是使用执行更新然后启动主应用程序的应用程序。 The main app checks for update and downloads it, but actually is not doing anything more than that.主应用程序检查更新并下载它,但实际上并没有做更多的事情。

Your options are either ClickOnce, which is the superior option of the two, or create a windows service that does the updating for you.您的选择是 ClickOnce,这是两者中的最佳选择,或者创建一个 windows 服务来为您进行更新。 The service runs all the time and pols for updates, downloads any and installs them.该服务一直在运行,并为更新、下载和安装它们进行 pols。 The reason this is superior to a preloader as suggested by Sascha is that in an environment where users log on with low level privileges the service will have admin privileges and be able to update the application.这优于 Sascha 建议的预加载器的原因是,在用户以低级别权限登录的环境中,该服务将具有管理员权限并能够更新应用程序。

Having said this, ClickOnce is the way to go.话虽如此,ClickOnce 是 go 的方式。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM