BitsUpdater

BitsUpdater is .NET library written in C# for automatic application update using Background Intelligent Transfer Service (BITS). This service is used by Windows Update and is friendly to network resources. Library has GUI tool for generating secure packages.

http://blog.chodounsky.net/2010/08/03/automatic-application-update-with-bitsupdater/

This project uses SharpBITS.NET library.

Features

  • Clean and understandable API
  • Network friendly updating
    • BitsUpdater uses only free network resources.
  • GUI tool for generating secure packages
    • BitsUpdatePacker is user friendly tool for generating packages with filters for obtaining files from your release folders.
    • Creates secure update packeges signed by certificate.
    • Differential packages for creating smaller packages with files that changed from your previous update package.

Usage

  • Use BitsUpdatePacker to create secure update package.
    • You will need to generate your certificate.
    • Select folders and file search options.
    • Url Directory is a directory where your update package will be stored on a server.
    • Copy your public token to your application to use it with BitsUpdater Update method.
  • Copy package with UpdateManifest.xml to your server.
  • Set configuration properties to locate UpdateManifest.xml on your server.
  • Integrate BitsUpdater to your application and set your custom update process or use featured ApplicationLauncher example.
    • For Update method you need public token provided by BitsUpdatePacker application.

static void Main(string[] args)
{
    BitsUpdater updater = new BitsUpdater("http://chodounsky.net/projects/BitsUpdater.Example/UpdateManifest.xml"
                                                             , Directory);
    RegisterUpdaterEvents(updater);
    updater.ResumePreviousDownload();
    updater.CheckUpdateAsync();
}

private static void RegisterUpdaterEvents(BitsUpdater updater)
{
    updater.UpdateDownloaded += (s, e) =>
        {
            Console.WriteLine("Update package is downloaded. Starting to apply update.");
            updater.Update(PublicToken);
        };

    updater.UpdateDownloadError += (s, e) =>
        {
            Console.WriteLine("Download error(" + e.Code + ") occured: " + e.Description);
        };

    updater.UpdateDownloadProgressChanged += (s, e) =>
        {
            Console.WriteLine("Downloaded " + e.BytesTranferred/1024 + "/" + e.BytesTotal/1024);
        };

    updater.UpdateChecked += (s, e) =>
        {
            if (e.UpdatesAvailable)
            {
                Console.WriteLine("New updates are ready to download!");
                updater.Download();
            }
            else
            {
                Console.WriteLine("There are no new updates.");
            }
        };
}
  • Usage examples
    • Project ApplicationLauncher shows how to use BitsUpdater with simple desktop process to use BitsUpdater.

Requirements

  • Microsoft Windows XP or higher
  • Microsoft .NET Framework runtime 2.0 (sources are written in 3.5 or higher)

Screenshots

  • Assembly Token which you have to provide to BitsUpdater Update method
Assembly Token which you have to provide to BitsUpdater Update method
  • BitsUpdatePacker is simple but effective tool for creating update packages
BitsUpdatePacker is simple but effective tool for creating update packages

Last edited Aug 3, 2010 at 10:36 PM by jakubgarfield, version 13