Windows Develop Bookmark and Share   
 index > ClickOnce and Setup & Deployment Projects > Need Help Woking Around Bug In CheckForUpdate
 

Need Help Woking Around Bug In CheckForUpdate

There is a note in the 3.5 documentation for CheckForUpdate that does not appear anywhere else:
Note:
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.)

Appearently, CheckForUpdate turns on check for update if it finds a new update is available thus defeating the whole purpose of manuallycontrolling the updates GUI and process.

It is therefore necessary to manually turn off the flag that CheckForUpdate setsto work around this bug.

It appears that this information is stored under:
[HKEY_CURRENT_USER\Software\Classes\Software\Microsoft\Windows\CurrentVersion\Deployment\SideBySide\2.0\PackageMetadata\

There is a registry key that matches the name of the directory that the currentversion of the application is installed in. Unfortunately the flags are not under it but under a sibling registry key. While it is possible to use a winapi call to manipulate this data, Microsoft's security by obscurity policy related to directory and key names in .Netwould reguire looking for the current version's directoryas a key nameand then searching the keys around it for the flag. The code would be ugly.

Can someone confirm that showing the new version available GUI is controlled by the flags in the metadata? If so, is that any .Net API that can be used by the application to manipulate its registry metadata or do I have to use a registry hack?
saberman  Friday, August 07, 2009 9:21 PM
Hello,

Thanks for your posting on MSDN forum.

First, let me confirm my understanding with you, you want to suppress the ClickOnce updater prompt when the ClickOnce is updated programmatically. Please correct me if there is any misunderstanding.

This isthe side effect of calling CheckForUpdate or CheckForDetailedUpdate API, because the update check result is persisted in the registry without installing the update. Then, the next time the ClickOnce application gets launched through the shortcut, it sees that there is an update and prompts the user.

To fix this, we can try to use the CheckForUpdate(bool persistUpdateCheckResult) or CheckForDetailedUpdate(bool persistUpdateCheckResult) API introduced in 3.5 SP1 and .NET Framework 2.0 SP2. We can set persistUpdateCheckResult to false, then the prompt is disabled.

More information
http://msdn.microsoft.com/en-us/library/cc646709.aspx

Thanks,
Rong-Chun Zhang
MSDN Subscriber Support in Forum
If you have any feedback on our support, please contact msdnmg@microsoft.com

Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
Rong-Chun Zhang  Monday, August 10, 2009 8:07 AM

I now have the registry hack that stops the ClickOnce Gui from appearing. I would prefer an official Microsoft API solution -- but in the absence of that I would be happy to share the registry hack -- please address requests to: sab@saberman.comuntil Microsoft releases a fix.

Please note that the registry hack allows your to check for updates without triggering the update GUI on the next execution of your application.

The only reason I did this is because they (Microsoft) said it couldn't be done:
http://msdn.microsoft.com/en-us/library/ms136935.aspx

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

saberman  Saturday, August 08, 2009 8:30 AM
Hello,

Thanks for your posting on MSDN forum.

First, let me confirm my understanding with you, you want to suppress the ClickOnce updater prompt when the ClickOnce is updated programmatically. Please correct me if there is any misunderstanding.

This isthe side effect of calling CheckForUpdate or CheckForDetailedUpdate API, because the update check result is persisted in the registry without installing the update. Then, the next time the ClickOnce application gets launched through the shortcut, it sees that there is an update and prompts the user.

To fix this, we can try to use the CheckForUpdate(bool persistUpdateCheckResult) or CheckForDetailedUpdate(bool persistUpdateCheckResult) API introduced in 3.5 SP1 and .NET Framework 2.0 SP2. We can set persistUpdateCheckResult to false, then the prompt is disabled.

More information
http://msdn.microsoft.com/en-us/library/cc646709.aspx

Thanks,
Rong-Chun Zhang
MSDN Subscriber Support in Forum
If you have any feedback on our support, please contact msdnmg@microsoft.com

Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
Rong-Chun Zhang  Monday, August 10, 2009 8:07 AM
Thanks -- unfortunately the 2.0 on-line docs do not include the overloaded methods so I learned a bit about ClickOnce's use of the registry.
saberman  Monday, August 10, 2009 2:56 PM

You can use google to search for other answers

Custom Search

More Threads

• ClickOnce: How to modify application settings during deployment?
• Do user app settings get overwritten when using clickonce deployement
• Exclude redundant dependancies in a setup project
• Publishing : Cannot make this application an online version
• Issue With Database Connections for Deployment
• how to add O2003PIA.msi to the prerequesite of a vb.net 2005 app
• Uninstalling old version while upgrading to new version(Installer class)
• copying the mdf file to another location using dailog box
• What would cause a program to try to reinstall itself when someone tries to run it?
• How to skip User Interface dailog box depends upon some condition?