Configure a ClickOnce deployment
May include but is not limited to: configuring the installation of a WinForms, WPF, or XBAP application; choosing appropriate settings to manage upgrades
Excuse me for putting this one first, but I needed something from another topic to dig into, because I got overwhelmed by data binding. So ClickOnce!
As you may know, ClickOnce is a deployment and distribution technology. Most of its functionality lives in dfsvc.exe. You can publish your application directly from Visual Studio with it, and can be very happy with the results, because if you’d set up the deployment appropriately, you’ll get automatic update checking and other cool features.
On the other hand, ClickOnce is very limited. You won’t be able to get inside to the setup menu, nor to tell the engine where you’d like to install your application. But as its name suggests, you can deploy an app by just a couple of clicks (yes, even by one click).
OK let’s get started. There are several places you can install your applications with ClickOnce. You can use a disk path, a UNC share, an FTP server or a web site. All of them have their pros and contras, and I think you’ll be able to figure them out yourself. After specifying this, you will be asked how the users will install your application. You can specify a web site for that (although you’ll need IE or Firefox with a little plugin to install directly from the browser). You can specify a UNC path, or tell the engine that you’d like to install from a CD/DVD. If you specify CD/DVD, then you’ll be asked whether or not you’d like to let your application check for updates, and if yes, where to do that.
If you choose a web site or a UNC path, then you’ll be asked if the app should be available offline or not. Setting online only mode has a nice feature – your users will be able to run the most recent release of your application (but only when they are online). Of course the engine will check for updates if you let it in offline mode as well.
When you finish the wizard, you’ll get some files at the end. You get a setup.exe file, a publish.htm file and an ApplicationName.application file. You also get a folder (in fact, one for each publish version) with the format ApplicationName_1_0_0_0 where two files will be places: ApplicationName.deploy and ApplicationName.manifest. You can’t really edit these files, because they are signed, and the engine would refuse to install the application if you’d do so.
When you install a ClickOnce application, you have no control over where your files will be installed. In fact, the app will be installed only for the current user, in the folder C:\Users\[UserName]\My Documents\Local Settings\Apps\ so it’s really difficult to find – and you can’t control the path. The good news is that you get some kind of special shortcut file which takes care all problems instead of you.
Let’s talk a little about how updates are done. You can specify two options when you’d like to check for updates – before or after the application starts. In the first case the startup time would be a little bit longer. In the second, you’d get updated only at the next startup. In both cases you are presented with a window which asks whether or not you’d like to update. And here comes the publish version into picture. If you publish an updated version of your application (by simply hitting the publish button again) you will only be notified about the update when you increment the version number (Visual Studio can do that automatically for you).