Browse DevX
Sign up for e-mail newsletters from DevX


Take the Pain Out of Deployments with ClickOnce : Page 4

Deploying Windows applications in the age of client-server computing has never been easy. But smart client architecture offers a revolution that makes deployments and maintenance stress-free. Find out how to use the ClickOnce technology to turn your clients into smart clients.




Building the Right Environment to Support AI, Machine Learning and Deep Learning

Managing Updates
Earlier in this article I showed that when you republish a modified application, the client will automatically detect the upgrade when the application launches. This is set in the Publish tab in the project properties window via the Updates… button (see Figure 16).

Figure 16. Configuring updates: This dialog is where you manage ClickOnce's behavior regarding updates.
Figure 17. Update Parameters: This is where you can tell ClickOnce how often the client should check in with the server to inquire about updates.

In the Application Updates dialog window (see Figure 17), you can configure when the application should check for updates—before or after the application starts. If you select the option to check for updates after the application has started, you can specify how often the check is performed—every x hour(s), x day(s) or x week(s). You also have the options to specify the minimum required version needed for the application. Finally, if the update location is different from the publish location, you can specify the update URL in this dialog.

By default, every time you publish the application the Revision number increments by one (see Figure 18). For Major, Minor, or Build number, you need to set them explicitly.

Clicking on the Application Files… button (see Figure 19) will display a list of files that will be deployed to the client's computer. If you are deploying databases using ClickOnce, be sure to set the correct value for the Copy to Output Directory property for the database. For example, consider the case where a user installs revision 1 of your application and populates the database with data. When you make changes to the application and republish the application, by default the database on the client would be overwritten by the original database. This is because the default value of the Copy to Output Directory property of the database is set to "Copy always", resulting in the deployment of the original database every time the application is republished. A much safer way would be to set it to "Copy if newer" so that the database on the client computer is only overwritten if it is older than the republished database.

Figure 18. Versioning: ClickOnce allows you to set the version numbers for your updates manually.
Figure 19. Files to Deploy: ClickOnce gives you a succinct list telling exactly what it intends to install.

The Prerequisites… button will show a list of prerequisites needed by your application (see Figure 20). By default, ClickOnce will automatically install the necessary prerequisites on the client's machine. This is a useful feature, especially the ability for ClickOnce to install .NET Framework 2.0 on machines that do not have it already.

Figure 20. List of Prerequisites: You don't have to spend time worrying whether client environments are primed with the proper prerequisites. ClickOnce does it for you.
Figure 21. Publish Options: You can decide what information should appear on the publish page.

The Options… button (see Figure 21) allows you to set the information displayed on the publish page, as well as some other options.

ClickOnce and Ready to Go
In this article, you have learned how to deploy a Windows application easily using the new ClickOnce deployment technology. Not only that, you have also seen how applications can be configured to update automatically. And in the last part of this article, I gave you a hearty look at how to configure the security settings of ClickOnce applications using Code Access Security.

Wei-Meng Lee is a Microsoft MVP and founder of Developer Learning Solutions, a technology company specializing in hands-on training on the latest Microsoft technologies. He is an established developer and trainer specializing in .NET and wireless technologies. Wei-Meng speaks regularly at international conferences and has authored and coauthored numerous books on .NET, XML, and wireless technologies. He writes extensively on topics ranging from .NET to Mac OS X. He is also the author of the .NET Compact Framework Pocket Guide, ASP.NET 2.0: A Developer's Notebook (both from O'Reilly Media, Inc.), and Programming Sudoku (Apress). Here is Wei-Meng's blog.
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