Turn off automatic updates with ClickOnce
I got an e-mail with the question how to turn off automatic checking for updates, when you’re doing a manual check for updates with ClickOnce. Strangely enough I forgot to mention this in my previous article.
The above dialog window can be obtained in the properties window of your project (Right-click your project in the solution explorer), under the “Publish” tabpage, using the “Updates…” button.
In the above window the “The application should check for updates” is turned on. Uncheck it and your application won’t automatically check for updates anymore.
Note that at the bottom, I’ve filled in the update location. For some reason, when you deploy your application with auto update turned off, it won’t be able to find the update location anymore. It’s being removed from the manifest! I have no idea if this is a bug or not, but it can be solved by entering the update location in the bottom textbox. Now the manual check for updates with ClickOnce works again.
Hi,
I was googling for a solution for the problem as described in the referenced article, concerning the “Launching Application” dialog.
Indeed, when un-checking the “The application should check for updates” check, the dialog is supressed until I call the CheckForDetailedUpdate() method in the ApplicationDeployment class. If I choose not to update the application, the dialog is back when restarting the application.
Is this a bug or am I missing something here?
However, nice walkthrough!!
Jeroen.
Hello Jeroen de Zeeuw, I’ve the same problem. It behaves like a bug.
Did you find a workaround?
I struggled with this for a while before finally figuring out what was going on. The CheckForUpdate() and CheckForDetailedUpdate() methods persist the results of the update check to disk. The next time the application runs, the ClickOnce mechanism sees that an update is available and prompts the user with the unwanted window. Apparantly the update is a two step process. Step 1 – Check the deployment location for updates and persist the information about what it finds to the local ClickOnce update cache. Step 2 – Check the local ClickOnce update cache and prompt the user with the update window if there an update is indicated. Unchecking “The application should check for updates” option seems to only cause ClickOnce to skip step 1. Step 2 still occurs. The CheckForUpdate() and CheckForDetailedUpdate() methods have the same effect as step 1 – the data is persisted to disk, so the next time the application is run, Step 2 sees the update and displays the update window. The trick is prevent CheckForUpdate() and CheckForDetailedUpdate() from persisting this information to disk. This can be done by useing the parametered overload (CheckForDetailedUpdate(persistUpdateCheckResult)) and set the parameter to false (CheckForUpdate(false) or CheckForDetailedUpdate(false)). The MSDN documentation for the persistUpdateCheckResult is weak at best and doesn’t explain this at all.
@Joe – thank you for explaining that persistUpdateCheckResult parameter. You are right that the MSDN documentation is weak at best. Fortunately a Google search led me to your comment and that makes a lot more sense now!
Its really helpful to me…Please spread out this information…lot of people asking the same question in the internet.
What you said works, but i have another issue. After all the check, when the actual update is happening and if the update fails because of network issues, next time when you open the application, the update window is coming again.
@Joe
Holy crap, thanks for pointing that out. This was driving me nuts.
Make your life time more simple take the loan and all you want.
We have the same problem with update dialog “Update/Skip” even with the “Check for updates” option unchecked.
We put the CheckForUpdates(False) lines at the beginning of our application (huge application) but it continues sending the dialog.
To find out where is the right place to put the lines, we put a messagebox right before this lines, but when we saw that first put the update dialog and then the messagebox.
Where I have to put it on? Is there a special generated code wrapping the application, and there is the right place to put the overload?
Desperate. Jose.
I’m not really sure what you mean. But when you turn off checking for automated updates, it shouldn’t check for them anymore. Period.
Of course, don’t forget that it’ll take an update of the client for these settings to transfer. So test it by updating at least 2 times after setting this option.
And make sure you don’t have an automated build or so that simply turns it on again! 🙂
This worked for me like a charm.
Thanks for the information. I had a problem with my unchecking of the “check for updates” box not being retained, enven though I did set an update location, as suggested. I found that I had to execute the publish process via the Publish Now button, using the wizard either from the publish page or from the menu caused the box to be automaticlly rechecked.
I have a problem with the manually update, when I unchecked the automatic checking for updates. In the next update my antivirus kaspersky Internet security 2012 detected like a virus. I don’t why does it happen?? do you have any ideas?
The antivirus message:
Detected: PDM.Worm.P2P.generic 01/10/2012 04:22:11 p.m.
PD.
I signined the clickonce manifests.
If I check the automatic checking for updates. the antivirus doesn’t blocked my application.