ApplicationDeployment.CheckForDetailedUpdate Method

Definition

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

Overloads

CheckForDetailedUpdate()

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

CheckForDetailedUpdate(Boolean)

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

CheckForDetailedUpdate()

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

C#
public System.Deployment.Application.UpdateCheckInfo CheckForDetailedUpdate();

Returns

An UpdateCheckInfo for the available update.

Exceptions

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

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

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.

Examples

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.

C#
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();
    }
}

Remarks

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

Applies to

.NET Framework 4.8.1 e outras versións
Produto Versións
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

CheckForDetailedUpdate(Boolean)

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

C#
public System.Deployment.Application.UpdateCheckInfo CheckForDetailedUpdate(bool persistUpdateCheckResult);

Parameters

persistUpdateCheckResult
Boolean

If false, the update will be applied silently and no dialog box will be displayed.

Returns

An UpdateCheckInfo for the available update.

Applies to

.NET Framework 4.8.1 e outras versións
Produto Versións
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1