Click here to Skip to main content
15,881,687 members
Articles / Operating Systems / Windows

Deploying Windows applications using ClickOnce (Visual Studio 2008)

Rate me:
Please Sign up or sign in to vote.
5.00/5 (3 votes)
15 May 2011CPOL3 min read 76.2K   8   6
How to deploy Windows applications using ClickOnce (Visual Studio 2008)

ClickOnce deployment allows you to publish Windows-based applications to a Web server or network file share for simplified installation. Visual Studio provides full support for publishing and updating applications deployed with ClickOnce. ClickOnce deployment is available for projects created with Visual Basic, Visual C#, and Visual J#, but not for Visual C++.

You can publish a ClickOnce application in three different ways: from a Web page, from a network file share, or from media such as a CD-ROM. A ClickOnce application can be installed on an end user's computer and run locally even when the computer is offline, or it can be run in an online-only mode without permanently installing anything on the end user's computer.

Open Visual Studio 2008 IDE and create a new Windows application.

img_01_new_project

Go to Project –> <Application Name> Properties –> Publish

img_02_project_properties_publish

Publish Location

Publishing folder location can be either web site (http://www.mydomain.com/installation/), FTP (ftp://mydomain/installation) or file share. If you are using other than a file share to deployment, then you can provide a Installation Folder URL, since the end users may not have the permission to access the publishing folder directly. (Since I am using a shared path, installation folder URL will not be required.)

Install Mode and Settings

If you select ‘The application is available online only’, each time it is run, it will be run from the published location and no start menu icon will be created.
But selecting ‘The application is available offline as well’, A shortcut on the Start menu will be created for the application and it will enable the application to be run when the user is disconnected from the network.

Publish Version

Here you should state the publish version (not the application version). And if you check ‘Automatically increment revision with each publish’ will make sure that the revision number will get incremented automatically when you publish your application.

Application Files

image

Sometimes it is necessary to publish other files than the application. So this is where you state which ones to include or exclude from the deployment.

Prerequisites

img_05_prerequisites

You can create a setup file to install the prerequisites, which are required by your application in order to function correctly. And all required prerequisites are selected automatically. But if you want, you can either add or remove them from your prerequisites setup.

Updates

img_04_application_update

In this window, you should define how your application should be updated. Check ‘The application should check for updates’. And choose whether it should be updated before or after the application starts. If you choose to update it after running the application, you can mention whether you want to check each time it runs or can mention a time period, which it should check. But it is always advisable to check before application starts, so users will get the latest updates each time they run the application.

And mention a minimum required version, so that end user will get the mentioned version of the application, if they have an older version installed on their pc.
If the updating location is other than the publish location, please mention the path.

Save settings and go to the form designer and add a label to the form.

img_06_version1_form
Save and go to Build –> Publish <Application Name>

img_07a_publish_wizard_scr_1

If you wish do any changes to the publish settings which you completed earlier, click next or click on the finish button.

img_07b_publish_wizard_scr_2

Click next.

img_07c_publish_wizard_scr_3

Click next.

img_07d_publish_wizard_scr_4

And the deployment setup will be created in the published path.

img_08_published_files

Run the setup.exe to install the application. And click on install button.

img_09_installing

img_10_version1_running

Now close the application and change the label to ‘Version 1.0.0.1’. And go to publish settings and on the update window, change the minimum required version to 1.0.0.1.

img_04a_application_update

Click ok and save settings and publish the application.
There will be a start menu shortcut from the first installation.

img_11_startmenu_installation

Click on that to run the application. You will see an update screen and the updated application will be downloaded, installed and executed.

img_10a_version2_running

Above mentioned are the basic steps which is required to deploy a .NET Windows application using ClickOnce.

For further information, please click here.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Technical Lead Air Liquide Industrial Services (Singapore)
Singapore Singapore
My passion lies in building business intelligence and data-based solutions, writing about things I work with and talking about it. New technologies relevant to my line of work interest me and I am often seen playing with early releases of such technologies.

My current role involves architecting and building a variety of data solutions, providing database maintenance and administration support, building the organization’s data practice, and training and mentoring peers.

My aspiration over the next several years is to achieve higher competency and recognition in the field of Data Analytics and move into a career of data science.


Specialities: SQL Server, T-SQL Development, SQL Server Administration, SSRS, SSIS, C#, ASP.Net, Crystal Reports

Comments and Discussions

 
QuestionDeployment of Click Once Application & run on another network system through URL of Server PC Pin
Member 1061618610-Oct-17 22:31
Member 1061618610-Oct-17 22:31 
BugError Mesage Pin
Perumal Gopikrishnan25-Jul-13 3:26
Perumal Gopikrishnan25-Jul-13 3:26 
GeneralRe: Error Mesage Pin
Manjuke Fernando25-Jul-13 18:12
professionalManjuke Fernando25-Jul-13 18:12 
GeneralMy vote of 5 Pin
alex871uk7-Feb-13 13:47
alex871uk7-Feb-13 13:47 
GeneralPublish fails. Pin
RedDk20-May-11 8:41
RedDk20-May-11 8:41 
AnswerRe: Publish fails. Pin
Manjuke Fernando20-May-11 14:23
professionalManjuke Fernando20-May-11 14:23 
You have to mention the publisher where to get the certificate from. Try following steps :

1. Go to project properties.
2. Go to 'Signing' tab.
3. Click the Check box labeled 'Sign the ClickOnce manifests'. This enables the sub-section (directly below the check box) where you can point to a certificate.
4. Click the 'Select From File' button, and select one from the available .pfx files.
5. From the sub section mentioned in step 3, click 'More Details' button, and it will display the certificate you have selected.
6. Click the 'Install Certificate' button and follow the prompts.
7. Save the solution.
8. Publish it.

Smile | :)
Manjuke Fernando

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.