How To: CAB Applications Staged Roll Out
Sometimes you deal with the scenario where you need to do a staged roll out deployment of your application where different types of users need to have different versions of your application. To achieve this task you can deploy your application in client side and control the versions available in server side using ClickOnce.
In this article you will find:
- Introduction to ClickOnce
- How to Publish the initial solution
- How to Publish different versions for different user groups
- How to Change the version available to a user group
- Special Considerations
System Requirements
- Microsoft Visual Studio 2005
- Microsoft .NET Framework 2.0
- Internet Information Services 6.0
- Internet Explorer
- Manifest Manager Utility tool
|
Note: You can find the Manifest Manager Utility in the ClickOnce Community Resource Kit (open the ManifestManagerUtility.sln solution). Smart Client Software Factory already brings this tool (you must install the source code and open the ClickOnce.ManifestManagerUtility.sln solution) |
Introduction to ClickOnce
ClickOnce is a smart client deployment mechanism that enables automatic deployment and update over the network from a deployment server. Using ClickOnce, you can take advantage of the capabilities of smart client applications and have the ease of maintenance and update of server-based applications.
The first step in ClickOnce deployment is publishing the application. This means placing the application files on the deployment server and generating two manifest files associated with a ClickOnce publication:
- deployment manifest: contains information about the publication, including the deployment provider URL, which indicates where the application will be launched from, the update policy, and a reference to the application manifest.
- application manifest: contains the list of files that the application is composed of and the set of permissions required to run the application.
Publish the initial solution
Preparing the solution
To use ClickOnce for deployment, you must first publish the initial version of the application. With a non-CAB application, this can be done by just publishing from Visual Studio. But with a CAB based application that dynamically loads modules not referenced in the Shell project, you have to perform some extra steps to prepare the published application for deployment.
- Open Visual Studio. Make sure that opening with administrator permission (right click, Run as administrator). Open the solution file of your application.
- Verify that your application can compile and run succeeded.
- Make sure that the property Build Action of the ProfileCatalog.xml file has been established to Content.
- Right-click in Shell project, and then click Properties.
- In the Publish tab, click in the Application Files… button. Make sure that all your files has been established the Publish Status and Download Group properties to Include and Required respectively.
Figure 1
Application files available to deploy
- Click OK.
- Click in the Options… button. In the dialog, fill the Product Name and Publisher name text box with your application data.
- Unselect de Open deployment web page after publish and Automatically generate deployment web page after every publish options.
- Click OK.
- Press the Publish Now button.
Adding dynamic libraries
With the previous steps you published the first version of your application but it is in an inconsistent state until you finish updating the manifests. To complete the publish task you must do the follows:
- Open the Manifest Manager Utility tool. Make sure that opening with administrator permission (right click, Run as administrator).
Figure 2
Manifest Manager Utility
- On the File menu, click Open.
- Browse to and select the published deployment manifest (C:\Inetpub\wwwroot\%MyApplication%\%MyApplication%.application).
- On the Edit menu, click Add Files.
- Navigate to the build output folder for your application solution.
- In the Add Application Files dialog box, select the libraries of your application’s modules, and then click Open.
- In the Browse For Folder dialog select C:\Inetpub\wwwroot\%MyApplication%\%MyApplication%_%version_number% folder.
|
Note: %version_number% represents the version number generated when you publish your application with Visual Studio. For example: 1_0_0_0. |
Figure 3
Browse For Folder dialog
- On the File menu, click Save.
- In the Select Publisher Certificate to Sign Manifest dialog box, click Browse, and then navigate to the publisher certificate that was generated by Visual Studio when you first published the application (%MyApplication%_TemporaryKey.pfx). Figure 4 illustrates this dialog box.
Figure 4
Manifest signing dialog box
- Click Save and Sign.
Publish different versions for different user groups
Every time that you publish your application with Visual Studio, the deployment manifest is overwritten. In this way, always points to the last application version. This behavior doesn’t allow you to have published more than one version.
To solve this situation you need to have different deployment manifest, one for each version. The following steps describe how to achieve this:
- Publish the initial version of your application. You will need to perform the steps explained previously.
- In Windows Explorer, open the publish folder (C:\Inetpub\wwwroot\%MyApplication%).
- Locate the file %MyApplication%.application. This file is generated every time that you publish or update your application with ClickOnce.
- Rename it for %MyApplication%-Release.application. In this way you avoid to override the file every time that you publish the application.
- Open the Manifest Manager Utility tool. Make sure that opening with administrator permission (right click, Run as administrator).
- On the File menu, click Open.
- Browse to and select the published deployment manifest (C:\Inetpub\wwwroot\%MyApplication%\%MyApplication%-Release.application).
- In the Application Identity box, type %MyApplication%-Release.application. Changing the Application Identity allows to support side-by-side execution of two versions of the same application on the same computer.
- In the Deployment Provider box, type http://%server%/%MyApplication%/%MyApplication%-Release.application. This will be the URL where the user download the application.
Figure 5
Editing a deployment manifest
- Click Save.
- In the Select Publisher Certificate to Sign Manifest dialog box, click Browse, and then navigate to the publisher certificate that was generated by Visual Studio when you first published the application (%MyApplication%_TemporaryKey.pfx).
- Click Sign and Save and close the Manifest Manager Utility tool.
- Repeat these steps for each application version changing Release for another version.
- Provide your users the correct URL to download the application.
Change the version available to a user group
Prerequisites
A specific user group must have an initial version published.
Steps
When you want to change the version available for a user group, you must edit the deployment manifest corresponding to that user group to points to the right application manifest.
To do this you should do the follows:
- Publish the new version of your application. You will need to perform the steps explained previously.
- Open the Manifest Manager Utility tool. Make sure that opening with administrator permission (right click, Run as administrator).
- On the File menu, click Open.
- Browse to and select the published deployment manifest that you want to change that point to another version, for example C:\Inetpub\wwwroot\%MyApplication%\%MyApplication%-Release.application.
- In the Version box, type the version number of your application that you want to that user group use.
- Click Select… button to choose the correct application manifest.
- Navigate to the folder C:\Inetpub\wwwroot\%MyApplication%\%MyApplication%_%version_number% and select the %MyApplication%.exe.manifest file, then click Open.
Figure 6
Editing a deployment manifest to change the version
- Click Save.
- In the Select Publisher Certificate to Sign Manifest dialog box, click Browse, and then navigate to the publisher certificate that was generated by Visual Studio when you first published the application (%MyApplication%_TemporaryKey.pfx).
- Click Sign and Save and close the Manifest Manager Utility tool.
Special Considerations
You might want to restrict the access to download URLs depending on the user role. The topic How to: Restrict Access Based on User Role in the ClickOnce Community Resource Kit documentation, contains detailed information about how to do this.
If you have versions of your application that share files, you can deploy them in a common place. For more information see the How to: Share Application Files Across Versions topic in the ClickOnce Community Resource Kit documentation.