I am working on customizing the ClickOnce deployment of our WPF application and I wanted to make sure I was not missing something about the process. As far as I know ClickOnce will handle installing the application, and optionally check for updates at startup, and also optionally check for updates on a set interval after the application starts. This can all be done without any custom code or customizations.
If we wanted to we can customize the installation process by writing our own “installation” program. It can be a standard WPF application that uses the following Walkthrough. This is a separate project from the application that is being installed.
Walkthrough: Creating a Custom Installer for a ClickOnce Application
We can so build a “Check for Updates Now” capability by implementing the code in the following walkthrough.
How to: Check for Application Updates Programmatically Using the ClickOnce Deployment API
What I am not sure about is can we customize the part where ClickOnce checks for updates at startup as the user clicks the shortcut to open the application? I like the idea of checking for updates each time the user opens the application but I would like to totally customize the process. As far as I can tell there does not seem to be a way to customize the part where ClickOnce checks for updates at startup. Can someone please verify that?
If it’s not possible to customize the “update at startup” process then one alternative I see is to not use ClickOnce at all and write our own custom code to handle installing, checking for updates at startup, and checking for updates while the application is running.
There are some other posts on SO that asked a similar question like this one.
Customize clickonce download screen
My Application does have a dynamic splash screen. Could I change that splash screen to show messages like Checking for updates…
and if none are found then continue to load the application. If updates are found then force the application to restart? The down side here is that we would see the splash screen twice.
If it were my own custom process then I would have two EXEs, one would be MyApplicatoinUpdate.exe
and the second would be MyApplication.exe
. The shortcut would launch MyApplicationUpdate.exe
to perform Checking for updates
and if some are found then download them (the files are not in use yet). If no updates are found then launch MyApplication.exe
and have MyApplicationUpdate.exe
shut it self down. Finally to update the updater put that logic in the MyApplication.exe
. Not sure if ClickOnce
will allow me to customize it that far.
Thanks, -eric