ClickOnce 检查更新,即使它不应该检查(在特定情况下)
我将 ClickOnce 应用程序设置为不检查更新(项目属性 -> 发布 -> 更新... -> “应用程序应检查更新”未选中),因为我以编程方式搜索它们,并让用户可以随时安装它们。
现在,在以下场景中:
- 应用程序已启动
- 使用 ClickOnce API 发现更新
- 应用程序未更新 应用
- 程序随后关闭
- 下次启动应用程序时,ClickOnce 窗口将提示用户安装或跳过更新。
如何避免这种情况?
有趣的是,如果用户跳过安装,下次启动应用程序时将不会再提示用户,因此应该有一些内容(在清单中?)告诉 ClickOnce 停止提示。
I set my ClickOnce application to not checking for updates (Project Properties -> Publish -> Updates... -> "The application should check for updates" is unchecked) since I programmatically search for them and I leave the user the possibility to install them whenever he wants.
Now in the following scenario:
- The application is launched
- An update is found using the ClickOnce API
- The application is not updated
- The application is then closed
- The next time the application is launched the ClickOnce window will prompt the user to install or skip the update.
How can this be avoided?
Interestingly, if then the user skip the installation, the next times the application will be launched the user will not be prompted any more, hence there should be something (in the manifest?) that tells ClickOnce to stop prompting.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我以前见过这样的事情。我认为发生的情况是,当应用程序启动时 ClickOnce 不会检查更新,这正是您所设置的。当您运行应用程序时,将以编程方式完成更新检查,并找到更新并可能设置一个标志。然后应用程序关闭而不更新,但标志仍然设置。下次启动应用程序时,ClickOnce 仍然不会检查更新,但因为设置了一个标志,表明有可用更新,它会提示用户查看是否要获取更新。我猜这是设计使然。
关于跳过更新的第二点,直到有另一个更新时才会再次提示您。我相信这是设计使然,如果您想返回并进行更新,您需要转到应用程序的 ClickOnce 安装页面。
理想情况下,您希望能够执行与使用应用程序部署 API 以编程方式跳过使用 ClickOnce 对话框时发生的相同操作。我快速浏览了可用的公共方法,但我看不到任何有关跳过的信息,但也许您可以找到一些东西。
编辑
刚刚再次查看了 API。您是否在不带布尔参数的情况下调用 CheckForUpdate() 或 CheckForDetailedUpdate() ?如果是这样,您收到提示的原因正如我所说,正在存储更新检查:
相反,您希望使用布尔值 false 来调用正在使用的方法,布尔标志确定是否应向用户显示对话框。
I have seen something like this before. I think what is happening is that when the application is start up ClickOnce does not check for an update, which is what you have set. When you are run the application an update check is done programatically and an update is found and presumably a flag is set. The application is then shutdown with out updating but the flag is still set. The next time the application is started ClickOnce still does not check for an update BUT because there is a flag set that there is an update available it prompts the user to see if they want to grab the update. I am guessing that this is by design.
In regards to the second point where you skip the update you will not be prompted again until there is another update. This I believe is by design, if you want to go back and do the update you need to go to the ClickOnce install page for the application.
Ideally what you want to be able to do is do the same thing that happens when you skip using the ClickOnce dialog programatically using the Application Deployment API. I have had a quick look at the public methods available but I cannot see anything about skipping but maybe you can find something.
EDIT
Just had another look at the API. Are you calling CheckForUpdate() or CheckForDetailedUpdate() without a boolean parameter? If so the reason you are getting the prompt is as I said the update check is being stored:
Instead you want to call the method you are using with a boolean value of false, the boolean flag determines if a dialog should be displayed to the user.
我看到 ApplicationDeployment.CheckForUpdate() 方法有一个重载
persistUpdateCheckResult
参数。不过,我使用的
CheckForUpdateAsync
没有任何此类重载。当我遇到这个问题时,这似乎意味着结果的持续存在。我想解决方案是我编写自己的异步调用......
I see that the ApplicationDeployment.CheckForUpdate() method has an overload with
persistUpdateCheckResult
parameter.However I am using the
CheckForUpdateAsync
which does not have any such overload. It appears to imply the persistence of the result as I am running into this issue.I guess the solution is I write my own async call...