Click here to Skip to main content
Click here to Skip to main content

Click Once Deployment Technique

By , 27 Jul 2009
 

Introduction

Deployment of Windows Application has always been a not-so-easy task. We had to create Deployment Project, ship it via some media and then it had to be installed to make the application available to use. Moreover, maintaining or managing updates and patches were even more challenging. ClickOnce technology introduced with .NET Framework 2.0 takes care of all the challenges of conventional Windows Application Deployment Issues. Let us get into the core of it.

Key Features of ClickOnce Technology

  • We can develop Windows forms application and by using the Publish option to deploy the application onto any of the following locations: File System, Local Web Server, FTP Site, or a Remote Web Site. 
  • Once the application is deployed onto the target location, the users of the application can browse to the publish.htm file using any web browser and install the application onto their machine. Note that publish.htm file is the entry point for installing the application.
  • Once the user has installed the application, a shortcut icon will be added to the Start Menu and also the application will be listed in the Control Panel/Add Remove Programs. 
  • When the user launches the application again, the manifest will contain all the information to decide if the application should go to the source location and check for updates to the original application. Let us say, for instance, a newer version of the application is available, it will be automatically downloaded and made available to the user. Note that when the new version is downloaded, it is performed in a transacted manner meaning that either the entire update is downloaded or nothing is downloaded. This will ensure that the application integrity is preserved.

How It Works

Let us start with a Simple WinForm Application. I have created a Windows Forms Application in C# named ClickOnceDeploymentDemo with one form with a button and added a simple code to display the assembly path with the button click event. Refer to the following screen shots:

P1.jpg

P2.jpg

When you execute the project, you will see something like the following screen shot:

P3.jpg

Now right click the project and click on Properties to get the Property window and then click on Publish Tab for making the settings for deployment. Refer to the following screenshot. I have put in the publish location as a web server path, that can be accessed via web browser using HTTP. Also one can select the availability of application, whether online or offline mode and so on and so forth.

P4.jpg

There are additional settings like the Prerequisites for the application to work. By default .NET Framework is selected. One can select additional components that are required to run the application as pre-requisite. Refer to the following screenshot:

P5.jpg

Below the Prerequisite button, there is an Updates button for specifying the checking of application updates.

P6.jpg

Then Click on Options button to set the Publish Options in terms of language and the web page to get access of the deployment. Refer to the following screenshot:

P7.jpg

Once all the necessary settings are done, we can go ahead and simply Publish the application. Right click the Project and click on Publish button and follow the screen instructions for deployment. Refer to the following screen shots:

P8.jpg

P9.jpg

P10.jpg

P11.jpg

Clicking Finish will Publish the application for availability over the net. Now you can browse the web folder to check the files and folders that are published.

P12.jpg

The following screen shows how to access the published application for installation / deployment.

P13.jpg

Click on Install button to install the application:

P14.jpg

You will also notice the following changes as a result of the installation:

  • An icon is added to the Start menu. 
  • An entry is added in Control Panel -> Add/Remove Programs

From this point onwards, you can launch the application through the shortcut in the Start -> Programs menu.
From Add/Remove Programs, you can either completely uninstall the application or revert to the previous version, if there was one.

With every deployment or update over the existing deployment, the same shall be downloaded by the client machine once the connection is available to the server and the client installation gets updated automatically. The client installation checks updates once the application starts.

Conclusion

So, by now we learnt how to use ClickOnce technology to deploy our Win Application and make the same available over the net and how to manage the updates. This was a very simple example. For further studies, please refer to this URL.

History

  • 28th July, 2009: Initial post

License

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

About the Author

Robin_Roy
Other Brilliance Information Sdn Bhd
Malaysia Malaysia
Member
Working as a Senior Consultant with Brilliance MSC, Malaysia.
Love to evaluate new technologies and implement the same.
Believe in sharing knowledge.

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
QuestionClickonce Installationmemberbhargavpp10 Sep '12 - 19:51 
this process working fine for client pc that is not connected on Lan but when we are going to install lan machine that will not work and gives error like Downloading http://Server/clickOnce.application did not succeed .can you help me on this ,thanks a lot in advance
GeneralMy vote of 1memberr0drv31 Aug '12 - 6:09 
Anyone can read what the wizard screens says.
GeneralMy vote of 4member@amitgajjar27 Aug '12 - 18:44 
what if some other dependent software as per-requisite need to be installed ?
General"Web Server does not appear to have Front Page Extensions"memberMike749119 Jan '11 - 12:00 
I am attempting to publish a very simple WPF/C# application to a Windows Server via "Click Once".
 
I keep getting an error:
 
"Failed to connect to ... with the following error: Unable to create the website ... (URL to exxisting site page). The Web server does not appear to have FrontPage Extensions installed."
 
First off, I am amazed that FP Extensions are REALLY needed for this. Nevertheless, I hope someone has already solved this problem.
 
Please advise.
 
Thanks to all who reply.
 
-- Mike
Mike Transue
CTO, Director of Client Support
Lead Management Consultants, LLC
USA: California, Colorado, Nevada, Texas

GeneralAm with you up to image P11.jpg ... Error in Visual Studio => "Default certificate could not be created. Publish aborting." [modified]memberRedDK14 Oct '10 - 9:39 
Of note also is the Output error message "Build has been cancel(l)ed."
 
I am wondering about Signing. I see in the Solution Explorer that there's a certificate created. I know this is by design, but I also wonder why you never identify the next step in passing this whole Click Once pattern off as a valid institution.
 
Anyway, if I take your procedure a few steps further and "Sign the Click Once manifest" by locating that new treeview .pfx I discover that 1. I "Cannot publish because a project failed to build." and 2. because "An error occured while signing: Invalid provider type specified" image P12 becomes problematically as moot a point innn continuing.
 
Thoughts?
 
~~~~~~~~~
 
(second post) ...
 
Solved the Build cancelled error just above by changing the Prerequisites to a more modern value ".NET Framework 3.5 SP1" (actually by changing from the futuristic ".NET Framework 4.0 Client") at which the publishing took place! Brilliant, on that account. And thank-you.
 
However, now, as far as actual content goes I need to fill that in. Because basically after IIS7/Browse is defaultly right-clicked and summoned I get the obligatry "Directory not configured for browsing".
 
Sorry to be so literal about it. But language is key, yes?
 
Otherwise, great. This mashup goes along way in disspelling my loss of faith in Visual Studio upgrades.

 
Wink | ;)

modified on Thursday, October 14, 2010 3:56 PM

QuestionHow to insert a filemember000iceman00017 Jan '10 - 2:51 
Hi,
i tried it, but i've a problem.
In my project i've a file: an xml with some configuration parameters.
How to deploy it too?
I would in client pc:
- exe file (installed witk clickonce)
- xml file in the same directory.
 
how to include xml file too?
 
Thanks.
Generalmy vote of 5memberyanet200529 Oct '09 - 3:11 
Thanks for the article. Excelent introduction to click once.
GeneralMy Vote of 5memberAditithegreat3 Sep '09 - 16:24 
The effort is visible and useful article
GeneralRe: My Vote of 5memberRobin_Roy6 Sep '09 - 18:08 
Thanks for the appreciation.
QuestionHow to disable automatical execution after installationmemberMastak.ua2 Sep '09 - 3:38 
Hi..
 
How to disable automatical application execution after deployment / installation ?
When I press "Install" button ( publish.htm ) my application installed, shortcut created ( when selected offline mode ) but application immediatelly run.
What I need is "click-once" installation from the web, this done very well.. but all execution I will control.. I want execute application from shortcut, not anexpected auto execution from the web Frown | :( .
 
Is there some solution?

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

Permalink | Advertise | Privacy | Mobile
Web03 | 2.6.130523.1 | Last Updated 28 Jul 2009
Article Copyright 2009 by Robin_Roy
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid