Manual check for updates with ClickOnce

You may also like...

52 Responses

  1. It’s amazing to see how many people can find this blog entry via Google but don’t provide any comments or anything! ๐Ÿ™‚

  2. Antonio says:

    This post is really interesting. I’m researching on clickOnce to see if we can using in my job. Everything looks great, but I have a problem. For some policies of the company, I need to change the installation path. I can’t have clickOnce to install my apps per user in the cache folder. In my research I found that this is not possible. So I wonder if I can make a classic msi installer to setup the app for the first time (and have it installed where I want), but still using clickOnce for checking updates using your code example.
    How can I make the app to ‘think’ that has been deploy using ClickOnce, so the NotDeployedViaClickOnce status says so?
    Is this possible?

  3. Douglas Ross says:


    Thanks for the article, it is exactly what I am looking for….. Unfortunately, I am not that good a coder, and do not understand exactly where to make these changes.

    I also cannot find where MS Studio makes the wizard changes (other than in properties).

    I thought that if I found the default stuff set up by the wizard then I should be able to overwrite it with the delegations you have written above.

    Would you be able to post an example forms C# project, that shows exactly where you place this code.

    Apologies in advance, if I am being terribly simple and the answer is obvious.


  4. Hi Douglas,

    I’m giving a training today. If I find the time between practices or so, I’ll create and upload a solution.

  5. Seems like I did it faster than I expected. I added the example for VS2005 without the BackgroundWorker.

    The link is just below the article, as UPDATE 2.

    If you want one with the BackgroundWorker included, or anything else, let me know.

  6. nicolas says:


    How can I manually specify the update location.
    The application will be installed in multiple clients where internet is not available. So I need the administrator of each of our clients to manually copy the files to a specific location so that all clients can be updated.

  7. Rob Kent says:

    The main issues I have with ClickOnce are the install directory and config overwrites. Let’s assume I want my users to be able to manually update the app.config – firstly, how do they know where it is? Secondly, what happens on next update and I have made changes to the central copy – this would overwrite the customer’s changes.

    I’ve looked at lots of ClickOnce articles and have still not seen a satisfactory solution to this problem.

  8. Constandinos Iezekiel says:

    Very helpful article Dennis. It helped a lot ๐Ÿ™‚

  9. Muttly says:


    It’s an interesting article Dennis.

    Without sounding like a complete retard (I have my moments!), what files do we need to put where to set up updates?

    Thanks in advance for your help!


  10. Dennis van der Stelt says:

    I am preparing a post about doing builds with FinalBuilder, explaining also the entire process that needs to be done if you’d do this by hand.

    Hold on for it, I’ll finish it any time soon.

  11. Geir Brandt says:


    thanks for a thorough and excellent explanation. It was exactly what I hoped Google would help me with ๐Ÿ™‚

  12. Edgar Rodriguez says:

    This is a pretty interesting blog post. I just have one quick question, how do I specify in the publish stage in Visual Studio if a update is required?, I mean, where does the info.IsUpdateRequired variable is set? Do I have to modify the deployment manifest manually?


  13. Dennis van der Stelt says:

    “Publish” tab in project’s properties window

  14. Rich says:

    A few questions.

    1. Does the background worker check for updates with out a user physically pressing a button?

    2. With this code:

    ApplicationDeployment updateCheck = ApplicationDeployment.CurrentDeployment;

    UpdateCheckInfo info = updateCheck.CheckForDetailedUpdate();


    if (info.UpdateAvailable)



    MessageBox.Show(“The application has been upgraded, and will now restart.”);



    Can I place this on form Load?

  15. Dennis van der Stelt says:

    @Rich : 1. Yes, it can 2. Yes, you can.

    It’s probably wiser though to put the checking in parallel process with a BackgroundWorker for example.

    I did bump into one single Windows Forms application where this wasn’t wise, as it took 1 minute to load a LOT of data. After the 1 minute loading, it said “Hey, update, wanna install and restart the app?” and users of the app wouldn’t update because they had to wait another full minute. So checking for updates before the actual loading of the data took place was smarter! ๐Ÿ™‚

    Of course a complete redesign of the app was even more smarter, but there’s not always time for that.

  16. Rich says:

    Just wanted to reply, I did some other stuff, but by following your procedure I was able to help myself implement an update checker.

    I will try to figure out how to use the background checker in a future update ;).

    Thank you for posting this it has helped me.

  17. Dennis van der Stelt says:

    @Rich : No problem, good luck!

  18. Felipe de Jesús Meléndez Valencia says:

    How can i implement this solution in a class????

  19. Dennis van der Stelt says:

    @Felipe : What do you mean by that?

  20. BP says:

    Hi Dennis,

    This is really great stuff. Thanks for writing it up.

    I’m using Visual Studio 2010, could you tell me where to inject the deployment code? I have a WPF project and would like to turn off the automatic check for updates too, or at least control its behavior more.

  21. BP says:

    Nevermind, I ignore my last questions… I figured it out. Thank you for the article!

  22. Felipe de Jesús Meléndez Valencia says:

    It is possible, for example, if I have a BackgroundWorker in different forms in my application, that change in the role of main window. My question is: Can i put the code in the DoWork and RunWorkerCompleted events in a class and just call in the events, and how i can do it?. Thanks for all.

  23. Dennis van der Stelt says:

    @Felipe : Those questions aren’t ClickOnce related at all. You can put anything inside classes you want and have background workers there, or have backgroundworkers in your form execute the methods in your other class. There are a million possibilities there.

  24. Domnica says:


    I have some files needed for the application to run (dll-s that I cannot add as references because they are not .NET-style, other config files, etc, so they are not deployed by ClickOnce technology), so after publishing the app, I will copy by hand these files to the server, and when app starts I want to copy them dinamically from server to client local disk. (if this is the very first time the app is running on that machine and these files donโ€™t already exist on local disk). They will not modify from one version to another, so I wonโ€™t copy them to server every time.

    To copy these files from server to client, of course I have to know server (deployment) location and client location (directory where the app starts on local disk).
    For server location I tried to use ApplicationDeployment.CurrentDeployment.UpdateLocation, but it gave me MyApp.application (the content of deploymentProvider tag), so not the place where I can find
    For client location I tried to use ApplicationDeployment.CurrentDeployment.DataDirectory, but again this is not the directory from the local disk where the .exe locates.
    So I guess for client side I could use the old System.Windows.Forms.Application.StartupPath, right?

    But what can I do about server location? How to obtain Application%20Files/ MyApp_1_0_0_7/ letโ€™s say?


  25. Patrick McGowan says:

    Hello Denis,

    Did you answer Antonio’s comment as I have the same issue and am unable to solve this. Can you help:-

    Antonio said:

    This post is really interesting. I’m researching on clickOnce to see if we can using in my job. Everything looks great, but I have a problem. For some policies of the company, I need to change the installation path. I can’t have clickOnce to install my apps per user in the cache folder. In my research I found that this is not possible. So I wonder if I can make a classic msi installer to setup the app for the first time (and have it installed where I want), but still using clickOnce for checking updates using your code example.

    How can I make the app to ‘think’ that has been deploy using ClickOnce, so the NotDeployedViaClickOnce status says so?

    Is this possible?

    Regards: Patrick

  26. RudolfGutlich says:

    Hi, Iยดve stopped by your site and I am trying to use your tips. I am now stuck with two problems:

    1 – Iยดve disabled the autoupdate and did the check programatically.
    When I install the application and there is no new version on the site, there is no warning (ok).
    If there is a new one, then a dialog is shown and if if I select OK, the app updates itself.
    But, if I bypass the update option and quit the app, next time I run it then the “AutoUpdate” window of ClickOnce appears, showing the “OK” and “Ignore” buttons. Why is this happening? I double checked the Publish settings… ๐Ÿ™

    2 – I have a version in my web site, and I generate the .97 but I didnยดt published it to web, only installed directly.
    So, I have .97 installed in my computer and .96 in the site. But, when I start the app, it shows me that a newer version is on the site and, if I click OK to upgrade, then the .96 version replaces the .97 in my computer.
    How can I stop this bizarre behavior? It is a bug? It is also happening in other application that uses the AutoUpdate from ClickOnce.

    Well, besides that, very Thank You for your great site!

    Best Regards,

    Rudolf Gutlich.

  27. Carel says:

    Excellent! This solved a caching issue too for me!

  28. Shah says:


    I was wondering how ClickOnce detects that an application update is available. Does it look only at the application’s version number ? Lately, I changed my application clickonce deployment so that it is deployed in x86 mode instead of the MSIL mode. After doing this, clickonce was NOT updating my previously installed but it was installing a new copy of my application as if my application was being newly installed.

    Could anyone shed some light on how and when ClickOnce determines that it should update an application ? Whether changing parameters such as the application installation URL, Processor architecture and so on, make clickonce believe troubles Clickonce and make it consider the application being deployed as a brand new application ?


  29. Dennis van der Stelt says:

    @Shah : Thanks a lot for replying with the link! Probably helps others as well!

  30. Nice. I was looking for a simple, manual way to check for updates, and lo and behold, I found a fantastic family of routines to do it and do it well.

    Thanks for sharing. ๐Ÿ™‚

  31. StevieC says:

    Just deployed my first two ClickOnce apps, before i read this post!! Now need to change them and redeploy them!! Wish i’d found this post first!! Great Post and expertly explained!!


  32. Art Colman says:


    I’m wondering if you have any comments, suggestions, or opinions about how to use ClickOnce in an IE9 environment? I found the SmartFilter indication that a clickonce setup.exe is not typically run as very strong and would probably motivate a user not to try the program.



  33. Dennis van der Stelt says:

    @Art : The .application file/link is the one you want. It should run with no problems from any IE version. Firefox needs a small update.

  34. Machado says:

    Good job and good article

  35. Peter Durst says:

    Very Nice Tutorial.

    Thank you for sharing!
    Greetz Peter

  36. Remember to user checkForDetailedUpdate(false), or the nasty Win3.1 style dialog box will keep on showing…

  37. Rajesh says:

    Please provide a solution :
    I want to delete existing SQLCE version at client PC during Clickone installation programatically

  38. Smilwe says:

    Is it possible to programatically set update source location?

  39. Smiler says:

    Is it possible to programatically set update source location?

  40. Dennis van der Stelt says:

    @Smiler: Nope

  41. 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.

    I signined the clickonce manifests.
    If I check the automatic checking for updates. the antivirus doesn’t blocked my application.

  42. anand says:

    Hi.. I am also using Clickonce at work. I need to do manual checking for updates,and if the update is available need to update the application also. But I have a big problem,everything seems to be working fine. But the application never gets updated.Looks like Update() Method is not working.What could be causing so??..Any help would be appreciated..

  43. andy says:

    Hi Dennis,
    thanks for this stuff – i would like to implement this in my projects – was looking exactly for this kind of solution!! Two questions: the link in ‘Upate 2’ seems to not work anymore… do you still have this example code? And: is this explanation also available for VB.Net?
    Thanks, Andy

  44. Anand, sorry for the broken link. I’ve updated the article to include proper syntax highlighting and uploaded the solution again.

  45. Bharath says:

    Hi, Thanks for this very useful article on updating prgmatically with ClickOnce.
    I have a Winform application which has to be deployed using clickonce installer but the requirement is force updating when the application runs(like Chrome). I am not a very good programmer and would like to know your BackgroundWorker code example works for the Winform application too where the application should automatically checks for the updates without the intervention of the user and force update when needed or else inform the user about the update is available? Please do reply sir.

  46. saravan says:

    Hello Dennis,
    This is what exactly i need for my application. I have few questions.
    1.where do i need to deploy the above code.
    2.Need some reference on how to create ClickOnce application
    3.Will this automatically update the application or any manual process need to be done

  47. Hi Saravan,

    It’s been ages since I’ve used this. But code simply goes into your own application, just anywhere. And call it from where the application starts. You then have the option to force users to upgrade, or else quit the application. Or let them go through with older versions. Or version N-1, where only one version lower of the current one is used.

    There’s a ton of material online. Just create one and use the code from this article to update it manually.

    ClickOnce can already be enabled to always automatically update. This code is there to give you the option. I always like being in control, which is why I created this article.

  48. Milind says:

    Hi Dennis,

    This post is really helpful and interesting, but I am facing some issues in clickonce like if WPF application contains dynamically loading modules then it does not deploy the dll of this modules and external config file.

  49. Hi Milind,

    It’s been so long since I’ve done anything with ClickOnce, that I can’t recall how to do this. Isn’t there somewhere where you can specify which assemblies (.dll) should be included in the deployment? And if it isn’t and there’s no reference whatsoever, the final solution would be the ability to download the assemblies/modules. But that’s really hard, working with versions/updates and all.

    I’d definitely find a way to include additional files when creating the deployment package.

    Or am I completely missing the real issue here? ๐Ÿ™‚

    • Milind says:

      Hi Dennis,

      Yes, the issue is how to include additional files when creating the deployment package, I have tried to find a way where we can keep required assemblies of dynamic modules but no luck.
      Thank you for replying. Please share if you find any solution on this. ๐Ÿ™‚

  50. Erc Backman says:

    Great concise and quick help, thanks so much!

Click on a tab to select how you'd like to leave your comment

Leave a Reply

Your email address will not be published. Required fields are marked *