This documentation is archived and is not being maintained.

UpdateCheckInfo Class

Represents detailed update information obtained through a call to CheckForDetailedUpdate.

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

Public Class UpdateCheckInfo
Dim instance As UpdateCheckInfo

With UpdateCheckInfo, you can decide whether to upgrade your ClickOnce application based on information about the newest version. UpdateAvailable will return a Boolean value indicating whether there is a new update at all. The AvailableVersion property provides the version number of the new version, while MinimumRequiredVersion provides the earliest version that the user should have installed. IsUpdateRequired expresses whether the latest available update is required of the user. Finally, UpdateSizeBytes expresses the total size of the update.


Visual Studio adds the <deploymentProvider> element to the manifest only if the application is set to check for updates, so you either have to check The application should check for updates or specify an update URL in Update location in the Application Updates Dialog Box.

The following code example uses UpdateAvailable to determine if there is a new application update, and IsUpdateRequired to determine whether to ask the user to install the update.

Private Sub InstallUpdateSyncWithInfo()
    Dim info As UpdateCheckInfo = Nothing 

    If (ApplicationDeployment.IsNetworkDeployed) Then 
        Dim AD As ApplicationDeployment = ApplicationDeployment.CurrentDeployment

            info = AD.CheckForDetailedUpdate()
        Catch dde As DeploymentDownloadException
            MessageBox.Show("The new version of the application cannot be downloaded at this time. " + ControlChars.Lf & ControlChars.Lf & "Please check your network connection, or try again later. Error: " + dde.Message)
        Catch ioe As InvalidOperationException
            MessageBox.Show("This application cannot be updated. It is likely not a ClickOnce application. Error: " & ioe.Message)
        End Try 

        If (info.UpdateAvailable) Then 
            Dim doUpdate As Boolean = True 

            If (Not info.IsUpdateRequired) Then 
                Dim dr As DialogResult = MessageBox.Show("An update is available. Would you like to update the application now?", "Update Available", MessageBoxButtons.OKCancel)
                If (Not System.Windows.Forms.DialogResult.OK = dr) Then
                    doUpdate = False 
                End If 
                ' Display a message that the app MUST reboot. Display the minimum required version.
                MessageBox.Show("This application has detected a mandatory update from your current " & _
                    "version to version " & info.MinimumRequiredVersion.ToString() & _
                    ". The application will now install the update and restart.", _
                    "Update Available", MessageBoxButtons.OK, _
            End If 

            If (doUpdate) Then 
                    MessageBox.Show("The application has been upgraded, and will now restart.")
                Catch dde As DeploymentDownloadException
                    MessageBox.Show("Cannot install the latest version of the application. " & ControlChars.Lf & ControlChars.Lf & "Please check your network connection, or try again later.")
                End Try 
            End If 
        End If 
        End If 
End Sub


Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

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

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0, 2.0