ClickOnce manual updates

I’ve written some tutorials in the past to help people with manually updating their ClickOnce deployed applications.

  1. Manual check for updates with ClickOnce
  2. Turn off automatic updates with ClickOnce
  3. ClickOnce automated build and pfx file
  4. Creating ClickOnce deployment files using an automated build and FinalBuilder

clickonce_autoupdate_3[1]

Miscellaneous users still had problems with the updates not checking very well. Joe responded with a solution. I’m writing it down here so more people might benefit from it as well, especially since the comment didn’t contain any linebreaks! 🙂

As Joe mentions the methods CheckForUpdate() and CheckForDetailedUpdate() persist the information retrieved to disk. This way when performing the check for update again, the information is retrieved from disk. If you’ve chosen to skip the update, it won’t ask you again.

You can override this behavior by using an overloaded method of the above mentioned methods and specify that you don’t want the information to be persisted to disk.

ApplicationDeployment updateCheck = ApplicationDeployment.CurrentDeployment;
UpdateCheckInfo info = updateCheck.CheckForDetailedUpdate(false);

//
if (info.UpdateAvailable)
{
    updateCheck.Update();
    MessageBox.Show("The application has been upgraded, and will now restart.");
    Application.Restart();
}

Check the second line with the method CheckForDetailedUpdate where I pass a ‘false’ to specify that it should not persist the update information.