Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ClickOnce check for updates even though it should not (under a particular circumstance)

Tags:

c#

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.

like image 480
Mauro Ganswer Avatar asked Oct 25 '25 17:10

Mauro Ganswer


2 Answers

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.

like image 53
Bronumski Avatar answered Oct 28 '25 08:10

Bronumski


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

like image 45
Derek Avatar answered Oct 28 '25 08:10

Derek