How to: Download ClickOnce Application Updates (Visual Basic)

This example uses the My.Application.Deployment object to download and install the latest version of an application. The example does not update the application unless it is out of date and was deployed as a ClickOnce application.

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

Example

This example downloads and installs the update after using the IsNetworkDeployed property to make sure that the application is deployed using ClickOnce. The Update method does not update the application unless it is out of date. The application has to restart to use the update.

Sub UpdateApplication()
    If My.Application.IsNetworkDeployed Then
        My.Application.Deployment.Update()
    End If
End Sub

This code example is also available as an IntelliSense code snippet. In the code snippet picker, it is located in Application—Compiling, Resources, and Settings. For more information, see How to: Insert IntelliSense Code Snippets.

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.

See Also

Tasks

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

Reference

Deployment