Export (0) Print
Expand All

ApplicationDeployment Class

Supports updates of the current deployment programmatically, and handles on-demand downloading of files. This class cannot be inherited.


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

type ApplicationDeployment =  class end

The ApplicationDeployment type exposes the following members.

Public propertyActivationUriGets the URL used to launch the deployment manifest of the application.
Public propertyStatic memberCurrentDeploymentReturns the current ApplicationDeployment for this deployment.
Public propertyCurrentVersionGets the version of the deployment for the current running instance of the application.
Public propertyDataDirectoryGets the path to the ClickOnce data directory.
Public propertyIsFirstRunGets a value indicating whether this is the first time this application has run on the client computer.
Public propertyStatic memberIsNetworkDeployedGets a value indicating whether the current application is a ClickOnce application.
Public propertyTimeOfLastUpdateCheckGets the date and the time ClickOnce last checked for an application update.
Public propertyUpdatedApplicationFullNameInfrastructure. Gets the full name of the application after it has been updated.
Public propertyUpdatedVersionGets the version of the update that was recently downloaded.
Public propertyUpdateLocationGets the Web site or file share from which this application updates itself.

Public methodCheckForDetailedUpdate()Performs the same operation as CheckForUpdate, but returns extended information about the available update.
Public methodCheckForDetailedUpdate(Boolean)Performs the same operation as CheckForUpdate, but returns extended information about the available update.
Public methodCheckForUpdate()Checks UpdateLocation to determine whether a new update is available.
Public methodCheckForUpdate(Boolean)Checks UpdateLocation to determine whether a new update is available.
Public methodCheckForUpdateAsyncChecks UpdateLocation asynchronously to determine whether a new update is available.
Public methodCheckForUpdateAsyncCancelCancels the asynchronous update check.
Public methodDownloadFileGroupDownloads a set of optional files on demand.
Public methodDownloadFileGroupAsync(String)Downloads, on demand, a set of optional files in the background.
Public methodDownloadFileGroupAsync(String, Object)Downloads, on demand, a set of optional files in the background, and passes a piece of application state to the event callbacks.
Public methodDownloadFileGroupAsyncCancelCancels an asynchronous file download.
Public methodEquals(Object)Determines whether the specified object is equal to the current object. (Inherited from Object.)
Public methodGetHashCodeServes as the default hash function. (Inherited from Object.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodIsFileGroupDownloadedChecks whether the named file group has already been downloaded to the client computer.
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)
Public methodUpdateStarts a synchronous download and installation of the latest version of this application.
Public methodUpdateAsyncStarts an asynchronous download and installation of the latest version of this application.
Public methodUpdateAsyncCancelCancels an asynchronous update initiated by UpdateAsync.

Public eventCheckForUpdateCompletedOccurs when CheckForUpdateAsync has completed.
Public eventCheckForUpdateProgressChangedOccurs when a progress update is available on a CheckForUpdateAsync call.
Public eventDownloadFileGroupCompletedOccurs on the main application thread when a file download is complete.
Public eventDownloadFileGroupProgressChangedOccurs when status information is available on a file download operation initiated by a call to DownloadFileGroupAsync.
Public eventUpdateCompletedOccurs when ClickOnce has finished upgrading the application as the result of a call to UpdateAsync.
Public eventUpdateProgressChangedOccurs when ClickOnce has new status information for an update operation initiated by calling the UpdateAsync method.

You can configure your ClickOnce application to check for updates and install them automatically through the subscription element of the deployment manifest. Some applications, however, need finer control over their updates. You may want to install required updates programmatically, and prompt users to install optional updates at their convenience. By turning off subscription updates in the deployment manifest, you can take complete control of your application's update policies. Alternatively, you can use automatic subscription in conjunction with ApplicationDeployment, which enables ClickOnce to update the application periodically, but uses ApplicationDeployment to download critical updates shortly after they are released.

You can test whether your deployment has an available update by using either the CheckForUpdate or the CheckForUpdateAsync method; the latter method raises the CheckForUpdateCompleted event on successful completion. CheckForDetailedUpdate returns important information about the update, such as its version number and whether it is a required update for current users. If an update is available, you can install it by using Update or UpdateAsync; the latter method raises the UpdateCompleted event after installation of the update is complete. For large updates, you can receive progress notifications through the CheckForUpdateProgressChanged and UpdateProgressChanged events, and use the information in ProgressChangedEventArgs to notify the user of the download status.

You can also use ApplicationDeployment to download large files and assemblies on demand. These files must be marked as "optional" within the deployment's application manifest so that they are not downloaded during installation. You can download the files at any point during the application's duration by using the DownloadFileGroup or the DownloadFileGroupAsync method. You can download assemblies before they are loaded into memory by supplying an event handler for the AssemblyResolve event on the AppDomain class. For more information, see Walkthrough: Downloading Assemblies on Demand with the ClickOnce Deployment API Using the Designer.


If you update a ClickOnce application while the application is running, the user will not see the updates until you call the Restart method of the Application, which will close the current running instance of the application and immediately restart it.

ApplicationDeployment has no public constructor; you obtain instances of the class within a ClickOnce application through the CurrentDeployment property. You use the IsNetworkDeployed property to verify that the current application is a ClickOnce application.

ApplicationDeployment supports checking for updates and downloading updated files asynchronously by using the new Event-based Asynchronous Pattern Overview, which exposes completion callbacks as class events. ApplicationDeployment starts and manages the threads for you, and calls your application back on the correct UI thread. Through this class, you can update without locking up the application, so that the user can continue working while the update installs. If the user must stop all work while an update takes place, consider using the synchronous methods instead.


Performing asynchronous updates requires that your application import both the System.Deployment.Application and System.ComponentModel namespaces.

The following code example determines at application load time whether a new update is available; if a required update is available, the code example installs the update asynchronously. This code should be added to a form that contains a TextBox named downloadStatus.

No code example is currently available or this language may not be supported.

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

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