How to: Check for ClickOnce Application Updates (Visual Basic)
Collapse the table of content
Expand the table of content

How to: Check for ClickOnce Application Updates (Visual Basic)

This example uses the My.Application.Deployment object to check for available updates to the application. If the application was deployed as a ClickOnce application, the example displays appropriate user interface (UI) text.

For more information on ClickOnce applications and how to deploy them, see ClickOnce Security and Deployment and Publishing ClickOnce Applications.

This example uses the IsNetworkDeployed property to make sure that the application is deployed from a network using ClickOnce. Then it uses the CheckForUpdate method of the My.Application.Deployment object to check if a ClickOnce update is available for the application.

Sub CheckUpdateAvailability()
    If My.Application.IsNetworkDeployed() Then
        If My.Application.Deployment.CheckForUpdate() Then
            MsgBox("Update is available for download")
            MsgBox("No updates are available for download")
        End If
        MsgBox("Application is not ClickOnce deployed")
    End If
End Sub

Only applications that are deployed using ClickOnce can be updated using the My.Application.Deployment object. For more information on deploying a ClickOnce application, see How to: Publish a ClickOnce Application using the Publish Wizard.

Community Additions

© 2016 Microsoft