Saturday, August 29, 2009

ClickOnce Deployment of windows applications

Hi Geeks,
 
Today I was able to implement ClickOnce deployment of windows applications, and thought it would be helpful if I blog this. Wondering what is ClickOnce, well it cannot be told in a single word.
 
Ever came across a situation in which you had to manually install application in each and every node of a network? It is acceptable when the nodes are limited say around 5 - 10 nodes. But imagine a network having 50 or 100 nodes, located on different floors or even different buildings, and you need to install the application manually in each and every node, and you need to install in each and every node for every change ( either minor or major ) you have made to the application. 
To move around installing the application itself is tiring. Wouldn’t it be nice if we change something on the server and it reflects on all nodes? 
This can be achieved using ClickOnce deployment. ClickOnce deployment is, as the name suggests click once to publish the application and whoever is using the application get the newly published version automatically.
Anyway coming back to clickonce, I did not explore completely, so spare me if I am wrong anywhere. I am just putting the steps I have taken to implement ClickOnce.
 
Open the project properties and select Debug tab. In this make sure that the Configuration is set to Release or Active (Release), and Platform to Any CPU.
 
Now go to the Signing tab and check the Sign the ClickOnce manifests checkbox. You can sign the assembly if you desire.
 
Then go to security tab and check “This is a Full Trust Application.”
 
Then go to publish tab. In this you need to specify
•    publish path / location
•    installation URL ( optional )
•    Install Mode and Settings
•    Application Files
•    Prerequisites
•    Updates
•    Options
•    Publish version
 
Let’s go one at a time now.

Publish path / Location:
This is the location where the application is published, i.e. a setup file is created.
This is also the location where a client checks for updates.
 
Installation URL (optional)
This can be understood by seeing the publish screen
Install Mode and Settings:
Select the desired option, but I recommend to make the application available both offline and online.

Application Files:
Here we need to remember that the Application.ExecutablePath is neither \bin\debug or \bin\release, its always the root directory, so place any dependent files from debug \ release in the root directory.
Click on Application Files button and you can see the list of all the files that would be published.
Verify that all the files required are present in the list. If you know that some are not needed then you can exclude them by selection from the combobox.

Prerequisites:
Make sure all the necessary Prerequisites are checked, i.e. if your application uses crystal reports make sure Crystal reports is checked.

Updates:
The updates screen is self explanatory.
I would recommend to you to select before the application starts radio button.

Publish Version:
Make sure that Automatically increment revision with each publish is checked.
 
Now click on publish button, and you should be done.
 
Once you install the application from the publish location on every node, it will automatically check for updates from the publish location every time the application starts.
 
Hope I have covered everything. Please tell me if I missed out anything.
Happy publishing

No comments:

Post a Comment