1. Home
  2. Computing & Technology
  3. Visual Basic

Going beyond simple ClickOnce Deployment

By Dan Mabbutt, About.com

ClickOnce

Deploying applications using web networking is only the first goal of ClickOnce. The next one is to distribute updates with as much flexibility and ease as deployment. To demonstrate this, let's make a trivial change to our application. Let's just change the message displayed when the button is clicked:

MessageBox.Show( _
"We're Using ClickOnce! " & _
"And we're updating too!" _
)

Publish the solution again and notice that the next time you start the application, you get an Update Available dialog window asking you if you want to download a new version of the application from the server. (If you click the Install button in a single machine environment, the update happens automatically.)

ClickOnce has more tricks!

Suppose the update has a bug in it and you need to restore the previous version. ClickOnce to the rescue! The Add or Remove Programs function in Control Panel can back out the version to a previous version. Just click the Change/Remove button and select Restore the application to it's previous state radio button.

You can configure ClickOnce to check for new versions before or after the application runs. Right click on the project in Solution Explorer and select Properties to display a tabbed dialog with a LOT of options. To find this one, click the Publish tab and the Updates ... button. A radio button allows a selection of when the check is made.

The Prerequisites ... button is also an important button. This displays a checkbox selectable list of software requirements for the client machine ranging from (currently) Microsoft Data Access Components 2.8 to SQL Server 2005 Express Edition. ClickOnce requires .NET Framework 2.0 so it's preselected by default. You can add a requirement for any of the listed components and it's possible to add your own prerequisite requirements to the list. (This involves updating the bootstrapper for ClickOnce and is not a 'beginning' level task.)

The project properties tabbed dialog has so much that you can do in it that it would take a dozen articles like this to explain them all. But you can learn a lot just by browsing through them to see what's there.

ClickOnce is cool, but it's not for every project. To keep it as easy as it can be, and to maintain security, there's a lot that ClickOnce can't do. For example:

  • ClickOnce applications are installed for just one user. If several persons log onto the same computer with different logins, you have to install for each of them. You can't install an application for all users on a workstation.
  • You can't change the way the shortcut is installed using ClickOnce to install, for example, another shortcut for a help system. (You can always do this using other methods, such as creating a shortcut in the correct folder manually, but you can't get ClickOnce to do it for you.)
  • You can't use ClickOnce to install shared components in the GAC (Global Assembly Cache). In fact, you can't do anything out of the ordinary like creating a database, registering file types, or configuring registry settings.

If you need to do things like this, check out the next article in this series. We cover the new and improved Setup Projects for VB.NET 2.0!

Explore Visual Basic
By Category
About.com Special Features

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

Easy ways to connect two computers for networking purposes. More >

  1. Home
  2. Computing & Technology
  3. Visual Basic
  4. Using VB.NET
  5. Using ClickOnce Deployment in VB.NET 2005

©2009 About.com, a part of The New York Times Company.

All rights reserved.