oreilly.comSafari Books Online.Conferences.


AddThis Social Bookmark Button

The Magic of ClickOnce
Pages: 1, 2, 3

To install the application, click on Install SmartClient.

Note: There is a bug in Visual Studio Beta 1 that prevents you from installing the application through the web server. To bypass this bug, use the registry editor (regedit.exe) and set the RegisteredOrganization key located in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion with a value. For my case, I have set it to my company name--Learning Solutions.

You will be prompted with a security warning (see Figure 8). Click Install to install the application onto your machine.

Figure 8
Figure 8. Installing the application

The application can now be found in the Programs sub-menu of the Start menu (see Figure 9).

Figure 9
Figure 9. Locating the installed application

Updating the Application

The power of ClickOnce lies in its ability to update applications that have already been deployed. Imagine that 200 of your customers have downloaded your application and one week later you add some new features or fix a fatal bug. In this case, it would be a logistic nightmare to inform and update the 200 customers. ClickOnce automatically ensures that your users use the latest version of your application.

Let's modify the original SmartClient application by adding a new TimePicker control to it (see Figure 10).

Figure 10
Figure 10. Adding a new TimePicker control to the Windows form

To ensure that your users use the updated application, you need to build and publish the application again, following the steps outlined earlier. That's all you need to do.

The next time your user launches the application from the Start menu, the application will automatically check the source to see if there is a newer version available. If there is one, the Update Available window will be displayed (see Figure 11). Click OK to install and use the newer version of the application.

Figure 11
Figure 11. Downloading a newer version of the application

What happens if, after installing the newer version, the user decides that he wants to use the older version? No worries; he would just go to Control Panel and click Add or Remove Programs and select the application and click Change/Remove. The user has the option to either restore the application to its previous state, or remove the application (see Figure 12).

Figure 12
Figure 12. Restore the application to its previous state, or simply remove it


In this article, I have briefly walked you through the process of deploying a smart client application using the ClickOnce feature in Visual Studio 2005. Smart client application is the new paradigm in deploying and developing your application. If you need to deploy a highly responsive networked application, the smart client model may just be the right one for you. Note that I have not discussed the security aspect of using ClickOnce; I will address this issue in a future article.

Wei-Meng Lee (Microsoft MVP) is a technologist and founder of Developer Learning Solutions, a technology company specializing in hands-on training on the latest Microsoft technologies.

Return to the