Monday, January 14, 2013

How-to Launch a Program with SingleAppLauncher

I recently released SingleAppLauncher. It's a tiny .NET program that runs the latest installed version of a single application. If your program automatically updates, this allows for easier program updates.

Here's a quick guide of how to use SingleAppLauncher in your application.

Directory Layout and Configuration

SingleAppLauncher requires a specific directory layout in order to work properly. It must be placed in the root directory of an application, and each program directory (with the .exe to launch) must be a version number. Here's an example adapted from SingleAppLauncher's readme:

C:\App\
  • app.exe (SingleAppLauncher)
  • app.exe.config (SingleAppLauncher's configuration file)
  • 0.91\
    • program.exe
  • 0.92\
    • program.exe
    SingleAppLauncher can be configured in two different ways: configuration file and command-line arguments. For the sake of simplicity, this guide will only cover the configuration file. Here's an example (as a Github Gist):



    In this example, launching 'app.exe' (in C:\App\) will launch C:\App\0.92\program.exe. As of this writing, the version folder names must be exact version numbers according to the .NET Framework's Version class. For example, if the 0.92 version folder was named 'v0.92', SingleAppLauncher will launch '0.91\program.exe'. If both folder names have 'v' at the beginning, SingleAppLauncher will crash.

    Launching Your Program From a Shortcut

    Just have your program's shortcut point to SingleAppLauncher: it will take care of the rest. You should change the shortcut to use your program's icon.

    Including SingleAppLauncher With Your Program

    SingleAppLauncher is released under a permissive license, allowing you to bundle it with commercial and non-commercial software.

    I currently do not distribute SingleAppLauncher in binary form, and (for right now) you should clone the repository from GitHub and build SingleAppLauncher when you build your program.

    SingleAppLauncher currently requires .NET 4.0 to be installed on the build system as well as the client system.