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.
Go to Project –> <Application Name> 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
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
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
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.
Save and go to Build –> Publish <Application Name>
If you wish do any changes to the publish settings which you completed earlier click next or click on the finish button.
Click next
Click next
And the deployment setup will be created in the published path.
Run the setup.exe to install the application. And click on install button.
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.
Click ok and save settings and publish the application.
There will be a start menu shortcut from the first installation.
Click on that to run the application. You will see an update screen and the updated application will be downloaded, installed and executed.
Above mentioned are the basic steps which is required to deploy a .Net windows application using ClickOnce.
For further information please click here
CodeProject
Hi manjuke..
ReplyDeleteGood post..thanks lot..
Where do click once applications get installed to on the local users PC ?
ReplyDeleteHow would a user find a Config File (Application Settings) that was associated with an application after installing via click once ?
Thanks
All click once applications get installed to the following path :
ReplyDeleteC:\Users\[YourLoginName]\AppData\Local\Apps\2.0
In that folder it will create one or more folders.
E.g:
C:\Users\[YourLoginName]\AppData\Local\Apps\2.0\JZHVCXO4.2DY\7Y4C0G5T.2EL\samp..tion_fecb1ed0282cd357_0001.0000_f1200572c0418625\SampleClickOnceApp.exe
And the configuration file will be created as [Application].exe.config
E.g: SampleClickOnceApp.exe.config
once application is installed how user can make changes in application configuration file
ReplyDeleteIn my previous comment I have explained how to locate the configuration file. So you once it's found, you can do the alterations.
ReplyDeletethanks a lot for your post
ReplyDeleteCan we change the installation path of clickonce deployed application from "C:\Users\[YourLoginName]\AppData\Local\Apps\2.0 " to something user defined..?
ReplyDeleteNo it is not possible. Is there any particular reason why you want to customize the installation path ?
ReplyDeleteNice article.
ReplyDeleteWe have shared drive on network, and P:\CompName.Shared\ (Yes we have dot in folder name!) folder is shared to everyone. I am creating AppNameSetup folder under this folder and would like to publish application to this folder and users will install application from this folder.
I tried to publish and at step 'Where will the application check for updates?', I put same folder name as publish path it gives me error:
"Invalid value for 'Update URL'. The string must be a fully qualified URL or UNC path , ..."
What am I doing wrong? is dot in folder name causing problem?
Thanks in advance.
Please provide the path as:
ReplyDeletefile:\\<ip_address>\<shared_folder> or \\<ip_address>\<shared_folder>
Then it should work..
I do not have ip address but I have fileserver name and that fileserver is mapped to P: drive. I changed to fileserver name with P: and put full UNC path, it published the package with setup.exe. Now when I clicked setup.exe I get this error: 'Cannot download the application. The application is missing required files. Contact application vendor for assistance.'
ReplyDeleteIn publishing process, at Prerequisites step, I selected 'Create setup program to install prerequisite componenets' and 'Download prerequisites from the same location as my application'
"One or more of the files listed in the application manifest cannot be found on the server. Verify that you have uploaded all the deployment's dependent files, and try again."
ReplyDeletehttp://msdn.microsoft.com/en-us/library/ms229001%28v=vs.80%29.aspx
Please check your manifest and see all the files are included on the folder.
Can you send me the error log ?
Hi, Thanks for the helpful article.
ReplyDeleteI am working on Window's application. Using VS-2010. I can publish the project too. But the Setup file always contain the same Name as of my project name. Is there a way i can name my setup file. So when I will install that file User will see that specific name and now the Project name.
I have one more question. When i create new assembly, I have to uninstall the old assembly. is there a way i can create an setup so that it will uninstall the old version and install the new version in one setup file.
Thanks in Advance,
Praj
Hi Praj,
ReplyDeleteWhat do you mean by the 'Setup File' ? Is it the manifest file that you are mentioning here. And if you set the minimum required version in the 'Application Update Dialog' it will make sure to install the new assemblies before running the application.
when i want to run this application from another PC do i need to install the application right? is there anyway to install in one location and run in another location without installing the application? thanks in advance
ReplyDeleteActually when you install the applicaiton it intalls to a location similar to
Delete'C:\Documents and Settings\\Local Settings\Apps\2.0\2Q7VNWAJ.ZDJ\GAWO8X0X.N0O'
**Please note last two folders can be varied.
So if you copy the contents to a different place it should work.
Hi Manjuke, nice article.
ReplyDeleteI have one question though, my installation path is a shared folder on a server, and to access the shared folder, the users must supply their credential.
When the users execute the application (installed locally), the application will not check for any updates if the users haven't connected to the server and save their credential. The current solution is to ask the users to connect to the shared folder before they execute the application.
How should I handle this kind of situation?
Thanks in advance
Thanks. Have you tried mapping that location as a drive, and connect automatically when the user logs in ? And if this shared path is in the same location, and permission is set to the required users, I think the credentials aren't required when user tries to access the path. Please check these things and let me know the out come.
ReplyDeleteThanks Manjuke, it works.
Delete