Login | Register   
RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX


ClickOnce: Delivering .NET Applications Via the Net : Page 3

With ClickOnce, Microsoft delivers a client-side application deployment and updating solution that offers a glimpse into the future, where centrally-located and managed applications delivered via the Web don't have to run in interface-challenged browsers.

Build A Simple ClickOnce Application
Here's how to create a simple "real-world" example .NET 2.0 application that will run only when the end user is connected to the Web. End users will see this simple application as just a link to the ClickOnce generated file on my Web site. First, create a simple .NET 2.0 application in Visual Studio 2005. You'll need a security certificate with which you can sign the manifests. For this article, I used a free certificate from Ascertia.com.

The Manifests
ClickOnce deployment is controlled by two essential XML files called manifests. One is the application manifest, which has an .exe.manifest file extension. This manifest summarizes the assemblies, required permissions, required libraries, etc. used by the executing application. Each application manifest is specific to one particular version of the application; consequently, each revision of the application caused by republishing from Visual Studio will produce a new application manifest. The other manifest is the deployment manifest, which contains secure links to the actual files the ClickOnce runtime uses to control the install process (the application manifest and itself). The deployment manifest also contains policy settings that determine the mode in which your application is installed (on-line or off-line), and govern update-mode settings. Unlike the application manifest, there is one and only one deployment manifest per application. A deployment manifest has an .application file extension.

The publishing operation creates the required manifests, signs them using your security certificate, and copies the necessary files to the target deployment environment you have selected. Open the Visual Studio 2005 Project Property Window from the Project menu and choose the last entry, which will have the name of your current project. The Project Property Window has 10 tabs. You use the last three tabs at the bottom on the left side of the window ("Signing," "Security," and "Publish") to set the parameters that control ClickOnce deployment and updating as shown in the following figures.

Figure 1. Signing Tab: The figure shows that the sample application requires signed manifests, signed (in this case) with the Ascertia certificate as shown.
Figure 2. The Security Tab: The figure shows the security settings for the sample application.
Figure 3. The Publish Tab: In this tab, set the Publish Location (the default is shown), and specify whether the application should be available offline only, or both on-and-offline.
Figure 1 shows the signing tab for the sample project. You can see that the security certificate from Ascertia.com has been selected—you click the button "Select from Store" to choose it. Next, look at the Security Tab in Figure 2. There you can see that ClickOnce Security is enabled and that I declared the test application should have full trust.

Finally, you carry out the real business of publishing in the publish tab (see Figure 3). Figure 3 shows the ClickOnce deployment mode set to "Online Only." For the publish location I accepted the default value publish\, which will create a folder inside the folder containing the current project. I strongly suggest that when you are ready to publish your project, you click the "Publish Wizard" button at this stage and let Visual Studio walk you through the steps of setting (or re-confirming) the publish location, selecting the mode of installation (from a Web site, from a UNC path or Web share, or from CD or DVD), and the location where the application will check for updates.

Note that this simple example didn't include any resources.

Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date