Sunday, December 26, 2004 2:01 AM bart

.NET v2.0 feature: ClickOnce


Maybe some of you remember the UAB (Updater Application Block) on .NET Framework v1.x that was released somewhere in 2003 in the patterns & practices space at MSDN (more info on Using this block it was possible to manage updates for .NET Framework-based software over the web. The underlying idea is relatively easy to understand: the application connects to a website on a regular basis to get data about the application version history that is kept centrally on a web server. If the application detects that a new version is available, the assemblies can be downloaded using BITS (Backgrount Intelligent Transfer Service, a service that is also used for Windows Update) and copied to the local machine. Once the download has completed, the updated application can be started (after validitation and checking). The UAB block is available via the Microsoft Downloads website on and is worth to check out if you did not play with it before.

What's going on?

Today we're seeing that these patterns & practices efforts are taken to the core of the CLR and libraries (think of Enterprise Library, see, which replace the application blocks we know today, see ClickOnce is one of these efforts which brings the UAB to the core of .NET. You can see ClickOnce as the MSI equivalent for managed code applications. For more info on the Enterprise Library take a look at my previous post on my blog, that contains a link to the downloads of the December 2nd MSDN Event @ Brussels where Rudi and David presented EntLib.

ClickOnce introduced

Some keywords and a little light meal exploration:

  • ClickOnce = UAB+; it contains all the features of the UAB but it's better integrated, positioned and it will be supported.
  • Integrated with Visual Studio 2005 through the "Project Properties", tab "Publish". The wizard-driven developers interface makes ClickOnce a really sweet experience.
  • Does not require the CLR on the client side; it contains a bootstrapper based on Win32 that can even deploy the .NET Framework Redist (and other redist packages such as J#, SQL 2005 Express, MDAC, etc).
  • ClickOnce has a rich API to control the download process and to provide offline support. There's also cryptography support for the manifests that are required on the server.
  • Whereas the UAB did not provide CAS (Code Access Security) preservation, the ClickOnce technology does. UAB runs in a fully trusted local app context, therefore ignoring CAS :-(.
  • Integrated support to launch the application online or offline (through the Start menu).

How to use?

In order to use it, you need the beta release or CTP release of Visual Studio 2005 (MSDN Subscribers have access to these releases, for more info check out the MSDN lab on The basic steps are these:

  1. In Visual Studio, create an application.
  2. Go to the properties of the project in the Solution Explorer and locate the Publish tab. Please note that this properties view is a huuuuuuuuuge improvement in VS2005, e.g. to strong-name assemblies without swapping to the command-line to run sn.exe.
  3. Specify the publishing/installation location and configure the settings (e.g. redist packages, and update configuration). It allows you to specify for example when the app should check for updates (at startup or while the app is running) and whether the user is in control to make the decision to install or deny the update.
  4. Also set the version of the software package (supports auto-increment) and if needed, other Publish Options.
  5. Next, start the Publish Wizard via Build, Publish or on the properties sheet.
  6. For deployment security and tamper resistance of your applications you need to sign the application. The wizard will guide you with creating or reusing a strong-name key.
  7. Finally, the app will be deployed to the specified location (webserver typically) and the system will guide you to the publication page. Users just need to click the link on this page to download and install the software. Client-side the system will pop up a warning about the publisher of the software etc.
  8. When you want to change the software, just go ahead and make the appropriate changes. Then republish the software with a new version number and deploy. Depending on the configuration, the update will be downloaded when the app is running or when the app is restarted.

Behind the scenes, a new MIME type for the extension .application (Windows Container File) will be registered. This is used to launch the bootstrapper and to check the security evidence of the application concerning the publisher etc. The file is an XML file that is checked by the application to detect whether updates are available or not. Updates are stored in subfolders of the deployment folder with the name %APPNAME%_%VERSION%, e.g. ClickOnceDemo_1.0.0.0. A sample .application file:

Update: due to problems with the display of the XML code in the browser, I removed the sample file; you can still find it here

Enjoy! | Digg It | Technorati | Blinklist | Furl | reddit | DotNetKicks

Filed under:


# ClickOnce - Not an ad for your camera!

Wednesday, January 12, 2005 9:01 AM by TrackBack

# ClickOnce - Not an ad for your camera!

Wednesday, January 12, 2005 9:33 AM by TrackBack