ApplicationDeployment::CheckForDetailedUpdate Method ()
Performs the same operation as CheckForUpdate, but returns extended information about the available update.
Assembly: System.Deployment (in System.Deployment.dll)
Return Value
Type: System.Deployment.Application::UpdateCheckInfo^An UpdateCheckInfo for the available update.
| Exception | Condition |
|---|---|
| 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 InstallUpdateSyncWithInfo() { if (ApplicationDeployment::IsNetworkDeployed) { ApplicationDeployment^ deployment = ApplicationDeployment::CurrentDeployment; UpdateCheckInfo^ updateInfo = nullptr; try { updateInfo = deployment->CheckForDetailedUpdate(); } catch (Exception^ ex) { MessageBox::Show("The update failed. Error: {0}", ex->Message); return; } if (updateInfo->UpdateAvailable) { bool doUpdate = true; if (!updateInfo->IsUpdateRequired) { System::Windows::Forms::DialogResult dr = MessageBox::Show( "An update is available. Would you like to " + "update the application now?", "Update Available", MessageBoxButtons::OKCancel); if (!(System::Windows::Forms::DialogResult::OK == dr)) { doUpdate = false; } } if (doUpdate) { try { deployment->Update(); MessageBox::Show( "The application has been upgraded, and will " + "now restart."); Application::Restart(); } catch (Exception^ ex) { MessageBox::Show("The update failed. Error: {0}", ex->Message); return; } } } } }
For full access to the local computer. Associated enumeration: PermissionState.
Available since 2.0