ClickOnce Application Reinstaller API

When Microsoft released Visual Studio 2005, it also included an application publishing and installation system called ClickOnce.  At that time I was working on a major WinForms application in .Net 2.0, and ClickOnce was an excellent discovery that perfectly met the needs of my application.  Fast forward a couple years and I had to make a couple updates to my application that required changing some prerequisite* software for the end user's PC.

These changes didn't break the application, but it did break the installation process.  All of my users had to uninstall and reinstall their application instance because the application would update my code but would not automatically install the new prerequisite file.  This was quite a headache but I fortunately had only about 100 users to help update, instead of some number that would have been legitimately unmanageable.

After a bit of research I found that ClickOnce has worked well for most users.  Developers can dig deep into the nuts-and-bolts of a ClickOnce application installation instance.  However, under certain circumstances, your application must be uninstalled and reinstalled when certain changes to the ClickOnce publication are made.

The application that I mentioned above is still in use by many users.  Recently I had to make another prerequisite change and I knew that I'd have to update all of my user's computers again.

Since ClickOnce does not provide a way to automate this update process, other's (see RobinDotNet's and Jim Harte's original blog posts on the mechanics of this solution) have found solutions to implement a forced uninstall/reinstall process for a ClickOnce app.

In response to this annoyance, and the fact that Microsoft has yet to manufacture a streamlined reinstall process, I've created an API which can easily be added to a ClickOnce application and called to check for and run reinstall-required application updates.

Checking for a required reinstall with the API is simple.  All you need to do is link the API, add one line of code to check your server.  When it's time to reinstall your application, add a text file named 'reinstall' at the root of the applications installation directory on the first line of the file, include the web address for the new installation.  That's it!

If you'd like to check out the API, head over to the ClickOnce Application Reinstaller API Google Projects page**.  I'm welcome to feedback and I am willing to expand the API if changes are requested.  One limitation of the API is that it's restricted to ClickOnce applications that have been installed with an Englished-based culture profile.  This is because of the uninstall process and if you're interested in the details, I recommend reading any of the above mentioned blog posts that inspired this project.

* For the uninformed, a ClickOnce prerequisite is any mandatory software that must be pre-installed on an end users PC before the application will run.  In my case, I had to update a Crystal Reports engine.

** This is my first open source project.  I intend to publish the source through Mercurial but I've hit a few snags.  The source is available from within the Download section of the project in a zip file.

No comments:

Post a Comment