ClickOnce application skips asking for an update (or fail launch if skip is selected)

六月ゝ 毕业季﹏ 提交于 2019-11-28 23:06:13
David

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

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>
PUG

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

deadlydog

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).

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!