ClickOnce 检查更新,即使它不应该检查(在特定情况下)

发布于 2024-11-25 14:20:11 字数 360 浏览 0 评论 0原文

我将 ClickOnce 应用程序设置为不检查更新(项目属性 -> 发布 -> 更新... -> “应用程序应检查更新”未选中),因为我以编程方式搜索它们,并让用户可以随时安装它们。

现在,在以下场景中:

  1. 应用程序已启动
  2. 使用 ClickOnce API 发现更新
  3. 应用程序未更新 应用
  4. 程序随后关闭
  5. 下次启动应用程序时,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:

  1. The application is launched
  2. An update is found using the ClickOnce API
  3. The application is not updated
  4. The application is then closed
  5. 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 技术交流群。

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

发布评论

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

评论(2

灼疼热情 2024-12-02 14:20:11

我以前见过这样的事情。我认为发生的情况是,当应用程序启动时 ClickOnce 不会检查更新,这正是您所设置的。当您运行应用程序时,将以编程方式完成更新检查,并找到更新并可能设置一个标志。然后应用程序关闭而不更新,但标志仍然设置。下次启动应用程序时,ClickOnce 仍然不会检查更新,但因为设置了一个标志,表明有可用更新,它会提示用户查看是否要获取更新。我猜这是设计使然。

关于跳过更新的第二点,直到有另一个更新时才会再次提示您。我相信这是设计使然,如果您想返回并进行更新,您需要转到应用程序的 ClickOnce 安装页面。

理想情况下,您希望能够执行与使用应用程序部署 API 以编程方式跳过使用 ClickOnce 对话框时发生的相同操作。我快速浏览了可用的公共方法,但我看不到任何有关跳过的信息,但也许您可以找到一些东西。

编辑

刚刚再次查看了 API。您是否在不带布尔参数的情况下调用 CheckForUpdate() 或 CheckForDetailedUpdate() ?如果是这样,您收到提示的原因正如我所说,正在存储更新检查:

如果 CheckForUpdate 发现有可用更新,并且用户
选择不安装,ClickOnce 会提示用户
下次运行应用程序时即可进行更新。没有
方法来禁用此提示。 (如果申请是必需的
更新,ClickOnce 将安装它而不提示。)

相反,您希望使用布尔值 false 来调用正在使用的方法,布尔标志确定是否应向用户显示对话框。

persistUpdateCheckResult 类型:System.Boolean
如果为 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:

If CheckForUpdate discovers that an update is available, and the user
chooses not to install it, ClickOnce will prompt the user that an
update is available the next time the application is run. There is no
way to disable this prompting. (If the application is a required
update, ClickOnce will install it without prompting.)

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.

persistUpdateCheckResult Type: System.Boolean
If false, the update will be applied silently and no dialog box will be displayed.

小糖芽 2024-12-02 14:20:11

我看到 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...

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