Вы находитесь на странице: 1из 7

Click Once Deployment Technique - CodeProject

http://www.codeproject.com/Articles/38546/Click-Once-Deployment-...

10,508,681 members (29,020 online)

home

articles

quick answers

discussions

Sign in

features

community

help

Next

Articles Development Lifecycle Installation General

Article
Browse Code

Search for articles, questions, tips

Click Once Deployment Technique

About Article

By Robin_Roy, 27 Jul 2009

Bugs / Suggestions
Stats

4.06 (36 votes)

Rate this:

Click Once Deployment


Technique in Visual Studio
Type

Article

Licence

CPOL

Revisions (2)
Alternatives

Introduction

First Posted

27 Jul 2009

Views

67,968

Bookmarked

73 times

Comments (26)

Share

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.

C# Windows .NET
Visual-Studio , +

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:

Top News
Microsoft makes source
code for MS-DOS and
Word for Windows
available to public
Get the Insider News free each
morning.

Related Videos

1 of 7

2/4/2014 12:07 PM

Click Once Deployment Technique - CodeProject

http://www.codeproject.com/Articles/38546/Click-Once-Deployment-...

Related Articles
Click Once Deployment
Configuration
How to Take Backup from SQL
Azure using Database
Deployment Technique
ClickOnce - Quick steps to
Deploy, Install and Update
Windows Based Client
Applications

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

How to create custom dialog


boxes using the Web Setup
Project in Visual Studio 2010
SmartClient: .NET Self Updating
Applications
WSE 3 Deployment: MSI and
ClickOnce
How to invoke Java web service
in ASP.net using C#
Create First OLAP Cube in SQL
Server Analysis Services
IIS security settings and
different permission using
installer class with custom
action
Building Your First SSRS Report
Converting an ASP.NET site into
a SharePoint site
Simple InstallShield tutorial
Deploying Workflow as WSP
File

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.

Computer Vision Applications


with C# - Part II
Intro to SOA Regression
Testing: A Hands-on Approach
Part 2: Windows Debugging
Techniques - Debugging
Application Crash (DebugDiag,
AppVerifier)
Developing with the Microsoft
Business Rule Engine
VS 2010 Deployment (Package,
One click deploy and
Web.config transformation)
Deploying Workflow as WSP
File
Manageable Services

Related Research

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:
The Essential Guide to Mobile
App Testing: Tips for
Developers in USA & Canada

2 of 7

2/4/2014 12:07 PM

Click Once Deployment Technique - CodeProject

http://www.codeproject.com/Articles/38546/Click-Once-Deployment-...

Essential Keys to Mobile


Usability

How to Secure Your Software


for the Mobile Apps Market

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

7 Tips for iOS 7

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:

3 of 7

2/4/2014 12:07 PM

Click Once Deployment Technique - CodeProject

http://www.codeproject.com/Articles/38546/Click-Once-Deployment-...

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:

4 of 7

2/4/2014 12:07 PM

Click Once Deployment Technique - CodeProject

http://www.codeproject.com/Articles/38546/Click-Once-Deployment-...

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.

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

5 of 7

2/4/2014 12:07 PM

Click Once Deployment Technique - CodeProject

http://www.codeproject.com/Articles/38546/Click-Once-Deployment-...

Click on Install button to install the application:

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


Article Top

6 of 7

2/4/2014 12:07 PM

Click Once Deployment Technique - CodeProject

http://www.codeproject.com/Articles/38546/Click-Once-Deployment-...

Robin_Roy

Comments and
Discussions

Other Brilliance Information Sdn Bhd


Malaysia

You must Sign In to use this message board.


Search this forum
Profile popups

Spacing Relaxed

Noise Medium

Layout Normal

Go
Per page 50

Update

First Prev Next

Working as a Senior Consultant with Brilliance MSC, Malaysia.


Myimplement
vote of 1 the same.
Love to evaluate new technologies and
Believe in sharing knowledge.
how to delete previous version
Clickonce Installation

TheUltimateDebugger

13-Sep-13 1:19

AFournierDelphi

4-Jun-13 22:07

bhargavpp

ABBYY Cloud OCR


r0drv
SDK
@amitgajjar

My vote of 1
My vote of 4

ocrsdk.com/Free_Trial

"Web Server does not appear to have Front Page Extensions"

10-Sep-12 19:51
31-Aug-12 6:09
27-Aug-12 18:44

Mike7491

19-Jan-11 12:00

99,8% Accuracy, Cross-Platform.


Samples,
Free =>
To Develop
Am with you up to image P11.jpgCode
... Error
in Visual Studio
RedDK

14-Oct-10 9:39

"Default certificate could not be created. Publish aborting."


[modified]
How to insert a file

000iceman000

17-Jan-10 2:51

my vote of 5

yanet2005

29-Oct-09 3:11

My Vote of 5

Aditithegreat

3-Sep-09 16:24

Re: My Vote of 5

Robin_Roy

6-Sep-09 18:08

How to disable automatical execution after installation

Mastak.ua

2-Sep-09 3:38

Good Article

arvindcoolest

Re: Good Article

Robin_Roy

My Vote of 5

johnclark64

Re: My Vote of 5

brown20

10-Aug-09 16:51

Robin_Roy

17-Aug-09 21:07

Deploying an application from VISTA to XP

AlexEvans

10-Aug-09 12:38

My vote of 1

Kjetil Klaussen

any idea on how you can install the application in the


program files folder?

Zillode

28-Jul-09 9:19

My vote of 2

Kschuler

28-Jul-09 5:20

good

pimb2

28-Jul-09 2:04

Uwe Keim

28-Jul-09 10:22

pimb2

28-Jul-09 22:50

Uwe Keim

28-Jul-09 23:28

Re: good
Re: good
Re: good
Last Visit: 31-Dec-99 18:00

Suggestion

10-Aug-09 17:12
17-Aug-09 21:00

Re: My Vote of 5

News

17-Aug-09 21:00

Robin_Roy

My Vote of 5

General

10-Aug-09 17:18

Question

Bug

Last Update: 1-Apr-14 14:05

Answer

Joke

Rant

4-Aug-09 10:03

Refresh

Admin

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.
Permalink | Advertise | Privacy | Mobile
Web01 | 2.8.140401.1 | Last Updated 28 Jul 2009

7 of 7

Layout: fixed | fluid

Article Copyright 2009 by Robin_Roy


Everything else Copyright CodeProject, 1999-2014
Terms of Use

2/4/2014 12:07 PM

Вам также может понравиться