In today's world, applications are quickly moving towards a simple, all-encompassing distribution model. Web applications are gaining popularity because of their scalability and ease of deployment, and desktop applications are becoming less common. This holds both positive and negative consequences - mainly with functionality and user experience.
Most applications need to ensure the best user experience possible for any given situation. In many cases, a web site meets the needs of both the developer and the consumer. However, some applications are better suited as a client-side, distributed application.
For these applications, the need arises for an easy and reliable method of deployment that allows the application the flexibility for any scenario. It should gracefully handle updates to the application, and be easily managed remotely. For this reason, DDay.Update came into existence - to provide an easy interface for adding automatic update functionality to your application, avoiding most of the headache involved in the update process, while allowing the most flexibility possible.
The technology that will be presented uses Microsoft's ClickOnce publishing mechanism that is built into Visual Studio 2005. It does not use ClickOnce itself. This is for many reasons:
- It's difficult to use your own deployment methods (use Windows Installer, for example) and still use ClickOnce for automatic updates.
- You cannot easily update individual files with ClickOnce, it's an all-or-nothing update, by default. This becomes problematic when your application is anything but very small in size, or you have very few users.
- To use a different GUI with ClickOnce requires a complete, built-by-hand interface. DDay.Update's GUI is pluggable. There is currently a pre-built interface for Windows Forms 2.0, and one will soon be available for .NET 3.0 (WPF).
- DDay.Update does not interfere with your application's security permissions.
- Open source applications lend to a better understanding of the underlying technology. Since DDay.Update and all its controls are open source, you are free to study and extend the code.
That said, if you haven't already, I encourage you to give ClickOnce a try. You may find that it suits your needs. When you find some of its features lacking, then give DDay.Update a try.
Note: DDay.Update is not a wrapper for ClickOnce. It simply consumes ClickOnce manifest files.
OK, what now?
In this article, I will present a bare-bones application, and give it automatic update functionality.
First, download the most recent binary version of DDay.Update from SourceForge.net. It is also included in this article for convenience.
Once downloaded, you're ready to begin.
We will now go through the following steps:
- Step 1 - Create an application to be automatically updated
- Step 2 - Publish the application
- Step 3 - Create a Bootstrap application
- Step 4 - Test it out
Step 1 - Create an application to be automatically updated
Create a new Console project in Visual Studio. Click File->New->Project, and select "Console Application" from the list. I named mine "AutoUpdatingApplication". You can choose whatever name you'd like (though it may be easier to follow examples if you use the same name).
Add a basic line of code to this application, such as:
Console.WriteLine("This is my application.");
Step 2 - Publish the application
We will use Visual Studio's ClickOnce mechanism to publish this simple application. This process is very simple. If you already know how to publish a ClickOnce application, skip to Step 3.
First, right-click on your console application project, and select "Properties".
Then, click on the "Publish" tab on the left, and click the "Publish Wizard" button:
Then, follow the steps of the wizard. Here's what I did:
Click "Finish", and your application should now be published to the location you indicated in the first step of the wizard. In my case, it's "C:\Deployment\DDay.Update.Test".
That's it, your application should now be published through ClickOnce!
Step 3 - Create a Bootstrap application
DDay.Update uses a bootstrap application to "mimic" the look and feel of your "real" application. In order to create this Bootstrap application, you need to use the Configuration Tool included in the binary distribution of DDay.Update.
First, open the Configuration Tool that you downloaded in the Preparation step of this example. Then, select File -> Open Deployment Manifest.
You will then see the following screen:
Enter the location where you published your application. This will include the name of your project, with a .application extension. In my case, it's:
Then, click Open. You will then see the main configuration screen, with some information automatically determined. The Update URI should already be provided - if it isn't, it should match the location where you published your application. In my case, it's C:\Deployment\DDay.Update.Test. When an Update URI is provided, you can click the "Verify URI" button to ensure that the URI is valid:
Then, choose an update notifier. This is the "pluggable" GUI that DDay.Update uses to display update information to the user.
Afterwards, choose a destination folder for the Bootstrap application to be created. I added a new folder on my desktop:
When you've completed these steps, you're ready to build the Bootstrap application. Click the "Create Bootstrap" button, and you should see a message as follows:
Then, the destination folder will automatically open, and you'll see your brand-new Bootstrap! If you run the executable in that folder, you'll see your application download the most-recent version and run it, and your folder will look like this:
Notice the folder named "126.96.36.199". That's where your "real" application is stored.
Congratulations, you've setup your application to automatically update!
Step 4 - Test it out
To see the update in action, open Visual Studio again, and publish a new version of your application. Then, go back to the "destination folder" where you created your Bootstrap, and run the application. You should see a message as follows:
Select "Upgrade Now", and the new version will download and run. You'll also notice that the directory structure of your application looks like this:
Notice the new "188.8.131.52" folder. The new version of the application has been placed here.
Note: If you chose "Upgrade Later", version 184.108.40.206 will be run, and no updating will occur.
Your application is now automatic-update-enabled.
When you distribute your application to your users, simply give them the Bootstrap application instead of the "real thing", and they will always receive automatic updates. You can even deploy your applications to your users through this method - no need to have them download your large application all at once. They can download the bootstrap application, and it will download the rest.
Points of interest
DDay.Update is in mid Beta testing. If you see anything strange or unexplained, please let me know by submitting a bug report here.
- 12/31/2007 - Article updated (Version 0.63)
- 11/13/2007 - Article updated (Version 0.61.1)
- 11/12/2007 - Article updated (Version 0.61)
- 07/23/2007 - Article updated
- 07/16/2007 - Initial revision (Version 0.52)