Dennis van der Stelt

I care about technology; I care about users more

Community

Email Notifications

News

  • Addicted to Refactor! Pro
    <div class="sideNavItems">

I read...

I Use...

Tags

Recent Posts

Archives

Blog Subscription Form

  • Email Notifications
    Go

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.

Comments

Felipe de Jesús Meléndez Valencia said:

Applied to your last example, where i need to put these code????

# April 20, 2010 5:11 PM

Dennis van der Stelt said:

@Felipe : Anywhere you want! You can do it

- when the application starts up in Program.cs

- when the application was launched in your form_loaded or something

- when the application was launched in your form_loaded, executing it via a backgroundworker

- behind a button that says "Check for updates"

Doesn't really matter.

Check the other links in the top of this article to find more info! :)

# April 21, 2010 10:13 AM

Felipe said:

Thanks. Sorry but i'm new in C#. Thanks for all. You made a great job and a great tutorials.

# April 27, 2010 7:01 AM

air max 95 said:

thank you

# September 6, 2010 10:43 AM

nike air max said:

It is my pleasure to read your article, your article is very wonderful. Thank you for sharing!

# September 21, 2010 9:51 AM
Leave a Comment

(required) 

(required) 

(optional)

(required) 


Please add 6 and 3 and type the answer here: