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:
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.
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.
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...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With