Deploying Smart Client Applications with ClickOnce
ClickOnce is a smart client deployment mechanism that has been part of the .NET Framework since version 2.0. ClickOnce enables automatic deployment and update of smart client applications over the network from a deployment server. ClickOnce lets you take advantage of the capabilities of smart client applications and still have the ease of maintenance and update of server-based applications. To deploy or update an application by using ClickOnce, you only need to publish your application to a deployment server, and then provide a link to the application to your users. When a user launches the application through the link, the application is automatically deployed and cached on the client computer; then it starts and runs from there.
ClickOnce supports many options, including the following:
- HTTP, UNC, or CD/DVD can be used for deployment.
- A URL or the Start menu can be used to launch the application.
- The application can be used online-only or online and offline.
- Updates can be checked for and applied at times you designate.
- Updates can be obtained from the location you specify.
- Updates can be mandatory or optional.
- A programmatic API can be used to explicitly control the update process.
ClickOnce supports two deployment modes: installed and online-only. The installed mode (available offline and online) supports the use of the application on the client computer even if the client computer cannot connect to the deployment server. Installed applications enable the user to launch the application by using a Start menu shortcut created when the application is first deployed to the client computer. Online-only applications must be launched via a URL to the deployment manifest on the server every time they are used; therefore, the client computer must be able to connect to the deployment server to run the application. The ability to operate offline is unrelated to the application's ability or inability to connect to the back-end services that the application is designed to communicate with for normal operations. Other forms of connectivity checking have to be used to determine whether the application can communicate with its back-end services after the application starts.
ClickOnce supports both automatic updates and programmatic updates. The automatic updates are done by the ClickOnce runtime on the client computer before or after the application starts. A number of options are supported. Programmatic updates are done by using the ApplicationDeployment class in the System.Deployment.Application namespace. For more information, see How to: Add On-Demand Programmatic Updates.
The options for automatic updates include the following:
- Checking for updates before the application starts, after the application starts, or both
- Making an update optional or required
- Checking for updates on a scheduled basis
- Checking for updates in a location different from the original installation
When performing automatic updates, ClickOnce first checks whether an update is available, and then applies available updates when the user next runs the application. As a result, if you want to delay the application of an update after it is on an update server, you will have do one of two things:
- Use the ClickOnce programmatic API to detect when the update is available, and delay programmatically downloading the update until your delay criteria are met (possibly by checking a remote service that tells the application when to update).
- Use a dynamic loading mechanism, such as the Composite UI Application Block profile catalog, to determine when to load and start using a file. ClickOnce can immediately download updates when they are available, but the profile catalog determines when those updates are applied. For more information, see How to: Apply Updates at a Future Time.