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)

public UpdateCheckInfo CheckForDetailedUpdate()

Return Value

Type: System.Deployment.Application.UpdateCheckInfo
An UpdateCheckInfo for the available update.

ExceptionCondition
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.

public void LaunchAppUpdate()
{
    if (ApplicationDeployment.IsNetworkDeployed)
    {
        ApplicationDeployment appDeploy = ApplicationDeployment.CurrentDeployment;
        appDeploy.UpdateCompleted += new AsyncCompletedEventHandler(appDeploy_UpdateCompleted);
    }
}

void appDeploy_UpdateCompleted(object sender, AsyncCompletedEventArgs e)
{
    if (e.Error != null)
    {
        MessageBox.Show("Could not install application update. Please try again later,  or contact a system administrator.", "Application Update Error");
        return;
    }
    else if (e.Cancelled)
    {
        MessageBox.Show("The application update has been cancelled.", "Application Update Cancelled");
        return;
    }

    // Process successful update.
    DialogResult dr = MessageBox.Show("The application has been updated. Restart?", "Restart Application", MessageBoxButtons.OKCancel);
    if (DialogResult.OK == dr)
    {
        Application.Restart();
    }
}

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

Community Additions

ADD
Show:
© 2014 Microsoft