6.9. Deploy Your Application with ClickOnceOne of the driving forces behind the adoption of browser-based applications is the fact that organizations don't need to deploy their applications to the client. Most companies are willing to accept the limitations of HTML in order to avoid the considerable headaches of distributing application updates to hundreds or thousands of users. Note: Want the functionality of a rich client application with the easy deployment of a web application? ClickOnce offers a new solution for deploying your software. Deploying a .NET client application will never be as straightforward as updating a web site. However, .NET 2.0 includes a new technology called ClickOnce that simplifies deployment dramatically. 6.9.1. How do I do that?ClickOnce includes a few remarkable features:
ClickOnce is tightly integrated with Visual Studio 2005, which allows you to deploy a ClickOnce application to a web site using the Project Publish menu command. The following steps take you through the process of preparing your project for publication:
Once the wizard completes, the automatically generated ClickOnce web page is launched, as shown in Figure 6-5. Using this page, a user can click to download and install your application. Try it out by clicking the Install [AppName] link. Figure 6-5. The ClickOnce installation pageThe installation runs without any messages, unless it needs to ask for user consent. For example, before the installation can add an icon to the Start menu, it needs to prompt the user. Best of all, now that the application is in place, you can make use of its automatic update ability. To test this out, return to the application in Visual Studio .NET and change the main form (perhaps by adding a new button). Then, increment the version number of the application. (To do this, double-click the My Project item in the Solution Explorer, select the Application tab, and click the AssemblyInfo button. A dialog box will appear that lets you set assembly metadata, including the version number.) Finally, republish the application. When a new version is available on the server, client applications will update themselves automatically, based on their update settings. If you run the installed sample application, it checks for updates when it starts. In this case, it will detect the new version and prompt you to install the update. Warning: The ClickOnce plumbing has been tweaked and refined continuously during the beta cycle. In some builds of Visual Studio, you may encounter an error when you try to publish a project using ClickOnce. Unfortunately, there aren't any workarounds. 6.9.2. What about......computers that don't have the .NET Framework 2.0 installed? These machines can't download and install a ClickOnce application automatically. However, when they surf to the ClickOnce installation page, they will see a link that will install the required prerequisites. There are a number of other approaches you can pursue to get .NET 2.0 installed on the client ahead of time. One easy choice is to use the Windows Update feature (surf to http://windowsupdate.microsoft.com from the client computer). 6.9.3. Where can I learn more?There are a number of articles that discuss the ClickOnce technology in much greater detail. For more information, you may want to refer to the book Essential ClickOnce (Addison Wesley, forthcoming), or the introduction from MSDN magazine at http://msdn.microsoft.com/msdnmag/issues/04/05/ClickOnce. You can also find a great deal of information in the MSDN help library, and online at http://msdn.microsoft.com/clickonce. |