ClickOnce 应用程序会跳过更新请求(如果选择跳过,则启动失败)

发布于 2024-08-08 18:49:35 字数 181 浏览 2 评论 0原文

我更新了我的 ClickOnce 应用程序,然后当用户运行时,系统会询问他们是否要安装新版本。

我在一个高度受控的环境中工作。当更新可用时,必须安装它(旧版本不能确保与数据库的向后兼容性)。

另一种选择是如果按下“跳过”则运行失败(这也可以正常工作)。

我需要某种方法来阻止他们运行旧版本的应用程序。

I updated my ClickOnce application and then when the user runs they are asked if they want to install the new version.

I am working in a highly controlled environment. When an update is available it has to be installed (backwards compatibility with the database is not ensured with old versions).

Another option is to fail the run if skip is pressed (that works fine too).

I need some way to stop them from running an old version of the application.

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

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

发布评论

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

评论(5

树深时见影 2024-08-15 18:49:35

这篇文章回答了你的问题。我向您指出这篇文章,而不仅仅是发布答案,因为文章中的所有内容都值得了解。

http://www.sayedhashimi.com/CategoryView,category,ClickOnce.aspx

以下为相关文章摘录:

强制 ClickOnce 更新

最大的卖点之一
ClickOnce 是自动更新。之一
我收到的常见问题
更新是“我怎样才能强制
用户更新?”

需要了解三件事
关于强制用户更新:

1) 如果您的申请是在线申请
应用程序,您的用户将永远
运行最新版本;在线的
每次都会下载应用程序
应用程序被访问。因此,
通过在线申请,您可以获得
默认情况下强制更新。

2) 如果您的应用程序已安装
应用程序,您可以通过以下方式强制更新
使用最低要求版本
属性。如果您发布您的
使用 Visual Studio 的应用程序,您
可以从更新中设置此属性
对话框。

3) 最后要注意的是,如果
您的应用程序已安装
应用程序(并且您还没有设置
最小必需版本属性)
ClickOnce 将提示用户
仅当出现“更新可用”对话框时
用户从以下位置启动应用程序
开始菜单快捷方式。也就是说,如果一个
应用程序已安装
应用程序并且用户启动
来自 URL 的应用程序,ClickOnce
强制更新。


我还发现了另一篇好文章:

ClickOnce:带来轻松和智能客户端部署的可靠性

This article answers your question. I'm pointing you to the article instead of just posting an answer because everything in the article is worth knowing.

http://www.sayedhashimi.com/CategoryView,category,ClickOnce.aspx

The following is the relevant excerpt from the article:

Forcing ClickOnce Updates

One of the big selling points of
ClickOnce is automatic updates. One of
the common questions I get with regard
to updates is "How can I force an
update on the user?"

There are three things to know with
respect to forcing updates on users:

1) If your application is an online
application, your users will always
run the latest version; online
applications get downloaded everytime
the application is accessed. Thus,
with online applications, you get
forced-updates by default.

2) If your application is an installed
application, you can force updates by
using the MinimumRequiredVersion
attribute. If you publish your
application using Visual Studio, you
can set this property from the Updates
Dialog.

3) The last thing to note is that if
your application is an installed
application (and you have not set the
MinimumRequiredVersion attribute)
ClickOnce will prompt the user with an
"Update Available" dialog ONLY if the
user launches the application from the
Start Menu shortcut. That is, if an
application is an installed
application and the user launches the
application from a URL, ClickOnce
forces the update.


I also found another good article:

ClickOnce: Bringing Ease and Reliability to Smart Client Deployment

乞讨 2024-08-15 18:49:35

这对我来说非常有效。将以下内容添加到项目文件中:

<UpdateRequired>true</UpdateRequired>
<MinimumRequiredVersion>$(ApplicationVersion)</MinimumRequiredVersion>

请注意,项目文件中的 ApplicationVersion 不能具有类似 1.0.0.* 的值,并且应在构建时递增以自动执行更新即可工作。

如果使用 TeamCity,要增加版本号,请转到项目的构建配置页面并设置以下系统属性

system.ApplicationVersion = %build.number%

您还可以获得 < strong>MSBuild 按时间增加版本,如下所示:

<UpdateRequired>true</UpdateRequired>
<BuildNumber>$([System.DateTime]::Now.ToString(yyyyMMdd))</BuildNumber>
<RevisionNumber>$([System.DateTime]::Now.ToString(mmss))</RevisionNumber>
<ApplicationVersion>1.0.$(BuildNumber).$(RevisionNumber)</ApplicationVersion>
<MinimumRequiredVersion>$(ApplicationVersion)</MinimumRequiredVersion>

This neatly worked for me. Add the following to the project file:

<UpdateRequired>true</UpdateRequired>
<MinimumRequiredVersion>$(ApplicationVersion)</MinimumRequiredVersion>

Note that ApplicationVersion cannot have a value like 1.0.0.* in the project file and it should be incremented at build time for auto-update to work.

If using TeamCity, to increment the version number go to Build Configuration page for your project and set the following System Property:

system.ApplicationVersion = %build.number%

You can also get MSBuild to increment version by time with something like this:

<UpdateRequired>true</UpdateRequired>
<BuildNumber>$([System.DateTime]::Now.ToString(yyyyMMdd))</BuildNumber>
<RevisionNumber>$([System.DateTime]::Now.ToString(mmss))</RevisionNumber>
<ApplicationVersion>1.0.$(BuildNumber).$(RevisionNumber)</ApplicationVersion>
<MinimumRequiredVersion>$(ApplicationVersion)</MinimumRequiredVersion>
笔芯 2024-08-15 18:49:35

除了David的回答之外,只需安装AutoUpdateProjectsMinimumRequiredClickOnceVersion nuget 包 在您的项目中。一旦您将项目设置为检查更新并使用所需的最低版本,这将确保所需的最低版本始终与您当前的版本匹配(即用户将始终被迫更新到最新版本)。

In addition to David's answer, simply install the AutoUpdateProjectsMinimumRequiredClickOnceVersion nuget package in your project. Once you have your project set to check for updates and to use a minimum required version, this will handle making sure the minimum required version always matches your current version (i.e. user's will always be forced to update to the latest version).

夜光 2024-08-15 18:49:35

它通过取消选中应用程序应该检查更新来起作用,并且应用程序在两个版本之后开始更新而不提示用户。

在此处输入图像描述

It worked me by unchecking The application should check for updates, and the application started updating without prompting the user after two versions.

Enter image description here

天冷不及心凉 2024-08-15 18:49:35

要在客户端上强制更新,您必须将最低版本字段设置为等于您正在部署的当前版本,这将强制更新而不使用“跳过”选项。

To force an update on the clients you must set the minimum version field equals to the current version you are deploying, this will force the update whiout "skip" option.

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