How to check for updates programmatically

I have a small ClickOnce application that runs (hidden) at user startup. It's used to update virus definitions. When using it on a laptop with a wireless network connection, the program isn't able to check for program updates because it takes a while until the network connection is established.
It's no problem to get my virus definitions, because there's a built in delay for that.
Is it possible to check for a new publish version (on a web server) by code

--Goos van Beek.


Answer this question

How to check for updates programmatically

  • Mahmoud Amereh

    Where should I write this code in the application

  • pcdog

    Yes. ClickOnce exposes a set of Application Update methods. See the System.Deployment.Application namespace for more info. Here are some useful pointers:

    http://msdn2.microsoft.com/library/twzfkahh(en-us,vs.80).aspx
    http://msdn2.microsoft.com/library/ms136930(en-us,vs.80).aspx

    Regards,
    Sameer

  • rniyas

    Great...

    May you write here the code for that please
    or the flowchart for that

  • Logifire

    This is really up to you. Common usage patterns are:
    - hook this off a "Check for Application updates" menu option, OR
    - do the check in the background on some periodic interval while app is running

    The advantage of these APIs is that it gives you greater flexibility and control over checking for and downloading updates, especially if one of the regular ClickOnce update options (via manifest) don't suit your needs. Also, since ClickOnce update checks are done at app startup time if your app runs for long periods of time without restart this is a good option to use.

    Regards,
    Sameer

  • Cowski

    Here's a link to MSDN site that has some sample code on ClickOnce API usage - http://msdn2.microsoft.com/library/system.deployment.application.applicationdeployment.

    Regards,
    Sameer



  • Main D. Tork

    Thanks, Sameer!

    This is what I was looking for.


    Regards,

    Goos



  • ShellShock

    Another question please,
    How can I raise the default checking update event
    The default mean which I have already set it in myproject page.

  • How to check for updates programmatically