A First ClickOnce Application With VB.NET

01
of 08

Step 1

WPF XAML Code for the Example Application.

In VB.NET, create a new project. For this example, I used a WPF application. You can use a Windows Forms Application if you like. Add a button or whatever you like to the form. I created this About Visual Basic application with one button that only displays a message. This illustration shows the WPF XAML code in my application.

02
of 08

The VB.NET Code and the Running Application

The VB.NET Code and the Running Application.

This illustration shows the VB.NET code and the running application.

03
of 08

Step 2

Click Publish to Start the Wizard.

Click the Build menu option to publish your solution and then select Publish. You can Build the solution to make sure it works first if you like, but if you're sure there are no problems, you can go straight to Publish.

04
of 08

Step 3

Select the Publish Location.

The first major decision that you must make in creating your ClickOnce solution is to decide what the publication location will be. ClickOnce has great support for different locations. In this case, I clicked "Next" to accept the default location that is conveniently filled in for me. This publishes the solution on my local computer in the \Publish folder. The location of this folder can be set in the Publish tab of the Project Properties. (Microsoft calls this the "Project Designer".) If you don't do anything, it's published to a \Publish folder in the same location that your project is in.

In real-world situations, you'll normally be distributing the application to other users and often over a network. ClickOnce has complete support for publishing in that mode, including automatic checking for updates and efficient downloads that only requires changes to be downloaded.

05
of 08

Step 4

Specifying How the User Installs.

This is the second decision that you need to make, and the last description - the default - is a little misleading. This description assumes that you are planning on distributing the application to other people and therefore you plan on using some sort of removeable media - like a CD-ROM. In fact, you could use a location on your local computer, a flash drive, even a floppy disk if you happen to still have one. This is just the "simple file" option that creates setup files. I used this last option to create the \Publish folder on my local computer.

06
of 08

Step 5

Select an Update Option.

ClickOnce updating works best for applications that are installed over a network for a lot of users. If you're installing on your own local computer as I am in this example, updating doesn't make sense. Simply reinstalling the application is easiest when a network isn't involved. I selected the default of no updating.

07
of 08

Step 6

Click Finish to Create the Setup Files.

Like the title says, you're ready to publish! Click Finish and the ClickOnce distribution files will be written.

08
of 08

Step 7

The Installed Application.

To install the application, click the Setup file in the Publish folder. The install checks out your installation environment and then installs. The end result is in your Programs and has an uninstall provided too.

There are many, many options provided by VB.NET for signing code for security, specifying prerequisites, changing the way updates are managed and lots more. Most of them are in the Publish tab in the Project Properties. It's worth browsing through the screens just to get an idea about what is available. (And it's faster than reading documentation!)

Click this link if you found this page from the article: Using ClickOnce Deployment in VB.NET