Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / Languages / C#

Building OpenPOS: Part 11 - ClickOnce

0.00/5 (No votes)
8 Sep 2010CPOL2 min read 8K  
ClickOnce

“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. ”

Codeplex + ClickOnce = ?

Codeplex now supports ClickOnce, so I decided to give it a test drive! To deploy your ClickOnce application to Codeplex, follow this EXCELLENT guide!

Try it out at http://openpos.codeplex.com/releases/52004/clickOnce/OpenPOS.application.

Semantic Versioning

Since I am now starting to “release” OpenPOS, I needed a better way to version it! Semantic versioning is a set of rules you should follow when creating public APIs. I will be loosely following these rules in versioning OpenPOS. Currently, I am at version 0.1.1.

“As a solution to this problem, I propose a simple set of rules and requirements that dictate how version numbers are assigned and incremented. For this system to work, you first need to declare a public API. This may consist of documentation or be enforced by the code itself. Regardless, it is important that this API be clear and precise. Once you identify your public API, you communicate changes to it with specific increments to your version number. Consider a version format of X.Y.Z (Major.Minor.Patch). Bug fixes not affecting the API increment the patch version, backwards compatible API additions/changes increment the minor version, and backwards incompatible API changes increment the major version.”

Auto Update Click Once

One of the great “features" of ClickOnce is that I can make it automatically check for new versions and silently update itself! OpenPOS has an extension method (for the Application class) called AutoUpdate(). To enable Auto-Updating of the application, simply call AutoUpdate() in your application class:

C#
public partial class App : Application
{
    protected override void OnStartup(StartupEventArgs e)
    {
        base.OnStartup(e);

        this.AutoUpdate(true);
    }

    // Removed for brevity
}

Now the application will periodically poll the ClickOnce server (CodePlex) for updates! If a new update is found, it will prompt the user if she/he wants it installed!

Also Read

The source is available on Codeplex.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)