I want to add a very very simple auto updater to my apps. I want to start with the simplest thing that'll work.
我想为我的应用添加一个非常简单的自动更新程序。我想从最简单的事情开始。
Any suggestions of how to do this? Any suggestions of improvements (or an alternative) to the option below?
有关如何做到这一点的任何建议?以下选项的任何改进建议(或替代方案)?
Here's one option I'm considering.
这是我正在考虑的一个选项。
- App displays a form that offers to check for a new version, with option to check again every X days.
- If user clicks "check now" it launches a web page www.mysite.com/CheckNewVersion.asp?AppID=<>?AppVersion=<>
- The ASP script has a list of all the program IDs and the currently available versions. IT then shows them either a page saying "No new versions available" or "New version with XYZ features/fixes" (and either "Free update" or "pay here").
应用程序显示一个表单,提供检查新版本,并提供每X天再次检查的选项。
如果用户点击“立即检查”,则会启动网页www.mysite.com/CheckNewVersion.asp?AppID = <>?AppVersion = <>
ASP脚本包含所有程序ID和当前可用版本的列表。然后,IT向他们显示一个页面,上面写着“没有可用的新版本”或“带有XYZ功能/修复的新版本”(以及“免费更新”或“在此付费”)。
This gives 80% of the benefit of auto updating with only 10% of the cost. If no one clicks on the autoupdate (and I suspect that's a possibility as people don't want to be bothered) then it's pointless to make it any simpler. There's no way to make it so simple that they don't have to at least click the "update" button.
这提供了80%的自动更新的好处,只有10%的成本。如果没有人点击自动更新(我怀疑这是一种可能,因为人们不想被打扰),那么让它变得更简单是毫无意义的。没有办法让它变得如此简单,以至于他们不必至少点击“更新”按钮。
BTW, I do realize that there is a similar question on SO but that didn't discuss the implementation details. It seemed more theoretical and aimed at a more sophisticated solution.
顺便说一句,我确实意识到在SO上有一个类似的问题但是没有讨论实现细节。它似乎更具理论性,旨在提供更复杂的解决方案。
2 个解决方案
#1
My suggestion (after building a few of these myself) is to start out with a slightly different system. Have your application run the check internally by looking at a static XML file on the server, ex: /AppVersion_[AppID].xml The xml file just describes the current public release with the current build/version number and maybe a timestamp and full path to the latest binary as well as an MD5 checksum. This will cut down a lot of work and complexity to start off with.
我的建议(在我自己构建其中一些之后)是从一个稍微不同的系统开始。让您的应用程序通过查看服务器上的静态XML文件在内部运行检查,例如:/AppVersion_[AppID].xml xml文件只描述当前版本号和当前版本号以及时间戳和完整路径的当前公共版本到最新的二进制文件以及MD5校验和。这将开始减少许多工作和复杂性。
Your application just pulls down this XML file and compares the version information in the file to its current version. If it's newer you could pop up a friendly dialog box asking the user to upgrade.
您的应用程序只需删除此XML文件,并将文件中的版本信息与其当前版本进行比较。如果它更新,你可以弹出一个友好的对话框,要求用户升级。
If the user does want to upgrade, pull down the setup binary from the path in the XML file, check the MD5 checksum and then launch it with shell execute. This saves the user from having to download your file and ensures that the file is downloaded without any problems.
如果用户确实想要升级,请从XML文件中的路径下拉设置二进制文件,检查MD5校验和,然后使用shell execute启动它。这样可以避免用户下载文件,并确保下载文件没有任何问题。
I would suggest upgrading from VB6 to VB.NET for the following reasons:
我建议从VB6升级到VB.NET,原因如下:
1) A magical control in the .NET BCL called WebClient that makes obtaining the string contents of a URL as easy as a one line call. Also, the WebClient will download a file to a specified disk location in one call.
1).NET BCL中一个名为WebClient的神奇控件,它使得获取URL的字符串内容就像一行调用一样简单。此外,WebClient将在一次调用中将文件下载到指定的磁盘位置。
2) Built in XML support is fantastic.
2)内置XML支持非常棒。
Here's some basic VB.NET code to get you started that will download one of your software products and run it:
这里有一些基本的VB.NET代码,可以帮助您下载一个软件产品并运行它:
Dim TargetRemoteSetupFile As String = "http://www.bungalowsoftware.com/downloads.asp?programlist=/download/aphasia_tutor_1_and_2_outloud_install.exe"
Dim LocalDownloadPath As String = System.IO.Path.Combine(System.IO.Path.GetTempPath(), "BungalowSoftwareInstall.exe")
Dim FileDownloaderWebClient As New System.Net.WebClient()
Try
FileDownloaderWebClient.DownloadFile(TargetRemoteSetupFile, LocalDownloadPath)
Catch ex As Exception
System.Diagnostics.Debugger.Break()
'...
Finally
FileDownloaderWebClient.Dispose()
End Try
System.Diagnostics.Process.Start(LocalDownloadPath)
#2
In Mac OS X, the Sparkle framework is very popular in apps for automatic updates. It works somewhat like this:
在Mac OS X中,Sparkle框架在用于自动更新的应用程序中非常流行。它有点像这样:
The first time the user starts an app, it will ask whether to check for updates automatically or not (and the interval between checks sometimes). When the user says they want to check for updates, the app will generally check for updates on startup, but no more than once per day.
用户第一次启动应用程序时,会询问是否自动检查更新(以及检查之间的间隔)。当用户说他们想要检查更新时,应用程序通常会在启动时检查更新,但每天不超过一次。
On the server there is an XML file or script producing such a file with the available software versions and a short summary or changelog for each version. When there is no update available, the app does nothing. The user is not informed AT ALL.
在服务器上有一个XML文件或脚本,生成这样一个文件,其中包含可用的软件版本以及每个版本的简短摘要或更改日志。当没有可用的更新时,应用程序什么都不做。用户未被通知。
When an update is available, the app prompts: "An update is available" with the new version number, the changelog and the following buttons: "Update" and "Skip this version".
当有更新时,应用程序会提示:“更新可用”,其中包含新版本号,更改日志和以下按钮:“更新”和“跳过此版本”。
The buttons are self-explanatory of course.
按钮当然是不言自明的。
#1
My suggestion (after building a few of these myself) is to start out with a slightly different system. Have your application run the check internally by looking at a static XML file on the server, ex: /AppVersion_[AppID].xml The xml file just describes the current public release with the current build/version number and maybe a timestamp and full path to the latest binary as well as an MD5 checksum. This will cut down a lot of work and complexity to start off with.
我的建议(在我自己构建其中一些之后)是从一个稍微不同的系统开始。让您的应用程序通过查看服务器上的静态XML文件在内部运行检查,例如:/AppVersion_[AppID].xml xml文件只描述当前版本号和当前版本号以及时间戳和完整路径的当前公共版本到最新的二进制文件以及MD5校验和。这将开始减少许多工作和复杂性。
Your application just pulls down this XML file and compares the version information in the file to its current version. If it's newer you could pop up a friendly dialog box asking the user to upgrade.
您的应用程序只需删除此XML文件,并将文件中的版本信息与其当前版本进行比较。如果它更新,你可以弹出一个友好的对话框,要求用户升级。
If the user does want to upgrade, pull down the setup binary from the path in the XML file, check the MD5 checksum and then launch it with shell execute. This saves the user from having to download your file and ensures that the file is downloaded without any problems.
如果用户确实想要升级,请从XML文件中的路径下拉设置二进制文件,检查MD5校验和,然后使用shell execute启动它。这样可以避免用户下载文件,并确保下载文件没有任何问题。
I would suggest upgrading from VB6 to VB.NET for the following reasons:
我建议从VB6升级到VB.NET,原因如下:
1) A magical control in the .NET BCL called WebClient that makes obtaining the string contents of a URL as easy as a one line call. Also, the WebClient will download a file to a specified disk location in one call.
1).NET BCL中一个名为WebClient的神奇控件,它使得获取URL的字符串内容就像一行调用一样简单。此外,WebClient将在一次调用中将文件下载到指定的磁盘位置。
2) Built in XML support is fantastic.
2)内置XML支持非常棒。
Here's some basic VB.NET code to get you started that will download one of your software products and run it:
这里有一些基本的VB.NET代码,可以帮助您下载一个软件产品并运行它:
Dim TargetRemoteSetupFile As String = "http://www.bungalowsoftware.com/downloads.asp?programlist=/download/aphasia_tutor_1_and_2_outloud_install.exe"
Dim LocalDownloadPath As String = System.IO.Path.Combine(System.IO.Path.GetTempPath(), "BungalowSoftwareInstall.exe")
Dim FileDownloaderWebClient As New System.Net.WebClient()
Try
FileDownloaderWebClient.DownloadFile(TargetRemoteSetupFile, LocalDownloadPath)
Catch ex As Exception
System.Diagnostics.Debugger.Break()
'...
Finally
FileDownloaderWebClient.Dispose()
End Try
System.Diagnostics.Process.Start(LocalDownloadPath)
#2
In Mac OS X, the Sparkle framework is very popular in apps for automatic updates. It works somewhat like this:
在Mac OS X中,Sparkle框架在用于自动更新的应用程序中非常流行。它有点像这样:
The first time the user starts an app, it will ask whether to check for updates automatically or not (and the interval between checks sometimes). When the user says they want to check for updates, the app will generally check for updates on startup, but no more than once per day.
用户第一次启动应用程序时,会询问是否自动检查更新(以及检查之间的间隔)。当用户说他们想要检查更新时,应用程序通常会在启动时检查更新,但每天不超过一次。
On the server there is an XML file or script producing such a file with the available software versions and a short summary or changelog for each version. When there is no update available, the app does nothing. The user is not informed AT ALL.
在服务器上有一个XML文件或脚本,生成这样一个文件,其中包含可用的软件版本以及每个版本的简短摘要或更改日志。当没有可用的更新时,应用程序什么都不做。用户未被通知。
When an update is available, the app prompts: "An update is available" with the new version number, the changelog and the following buttons: "Update" and "Skip this version".
当有更新时,应用程序会提示:“更新可用”,其中包含新版本号,更改日志和以下按钮:“更新”和“跳过此版本”。
The buttons are self-explanatory of course.
按钮当然是不言自明的。