Export (0) Print
Expand All

ApplicationDeployment.CheckForDetailedUpdate Method

Performs the same operation as CheckForUpdate, but returns extended information about the available update.

Namespace: System.Deployment.Application
Assembly: System.Deployment (in system.deployment.dll)

'Declaration
Public Function CheckForDetailedUpdate As UpdateCheckInfo
'Usage
Dim instance As ApplicationDeployment
Dim returnValue As UpdateCheckInfo

returnValue = instance.CheckForDetailedUpdate
public UpdateCheckInfo CheckForDetailedUpdate ()
public function CheckForDetailedUpdate () : UpdateCheckInfo
Not applicable.

Return Value

An UpdateCheckInfo for the available update.

Exception typeCondition

InvalidOperationException

The current application is either not configured to support updates, or there is another update check operation already in progress.

DeploymentDownloadException

The deployment manifest cannot be downloaded. This exception will appear in the Error property of the CheckForUpdateCompleted event.

InvalidDeploymentException

The deployment manifest is corrupted. Regenerate the application's manifest before you attempt to deploy this application to users. This exception will appear in the Error property of the CheckForUpdateCompleted event.

The CheckForDetailedUpdate method lets synchronous callers get the same extended information that asynchronous callers get using the CheckForUpdateCompletedEventArgs class.

The following code example uses CheckForDetailedUpdate to retrieve the information about the latest update. If an update exists, it installs it automatically only if it is a required update; otherwise, it prompts the user.

Dim WithEvents ADLaunchAppUpdate As ApplicationDeployment

Public Sub LaunchAppUpdate()
    If (ApplicationDeployment.IsNetworkDeployed) Then
        ADLaunchAppUpdate = ApplicationDeployment.CurrentDeployment
    End If
End Sub


Private Sub ADLaunchAppUpdate_UpdateCompleted(ByVal sender As Object, ByVal e As AsyncCompletedEventArgs) Handles ADLaunchAppUpdate.UpdateCompleted
    If Not (e.Error Is Nothing) Then
        MessageBox.Show("Could not install application update. Please try again later,  or contact a system administrator.", "Application Update Error")
        Exit Sub
    Else
        If (e.Cancelled) Then
            MessageBox.Show("The application update has been cancelled.", "Application Update Cancelled")
            Exit Sub
        End If
    End If

    ' Process successful update.
    Dim dr As DialogResult = MessageBox.Show("The application has been updated. Restart?", "Restart Application", MessageBoxButtons.OKCancel)
    If (System.Windows.Forms.DialogResult.OK = dr) Then
        Application.Restart()
    End If
End Sub

Windows 98, Windows Server 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0

Community Additions

ADD
Show:
© 2014 Microsoft