UpdateCheckInfo Class
Represents detailed update information obtained through a call to CheckForDetailedUpdate.
Assembly: System.Deployment (in System.Deployment.dll)
The UpdateCheckInfo type exposes the following members.
| Name | Description | |
|---|---|---|
![]() | AvailableVersion | Gets the version number of the latest uninstalled version. |
![]() | IsUpdateRequired | Gets a value indicating whether the update must be installed. |
![]() | MinimumRequiredVersion | Gets the minimum version that the user must have installed on the computer. |
![]() | UpdateAvailable | Gets whether an uninstalled update is available. |
![]() | UpdateSizeBytes | Gets the size of the available update. |
| Name | Description | |
|---|---|---|
![]() | Equals(Object) | Determines whether the specified Object is equal to the current Object. (Inherited from Object.) |
![]() | Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) |
![]() | GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) |
![]() | GetType | Gets the Type of the current instance. (Inherited from Object.) |
![]() | MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) |
![]() | ToString | Returns a string that represents the current object. (Inherited from Object.) |
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.
Note |
|---|
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.
public: void InstallUpdateSync() { if (ApplicationDeployment::IsNetworkDeployed) { bool isUpdateAvailable = false; ApplicationDeployment^ appDeployment = ApplicationDeployment::CurrentDeployment; try { isUpdateAvailable = appDeployment->CheckForUpdate(); } catch (InvalidOperationException^ ex) { MessageBox::Show("The update check failed. Error: {0}", ex->Message); return; } if (isUpdateAvailable) { try { appDeployment->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; } } } }
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
