Creating and Managing Add-in Packages

Mono.Addins follows the xcopy model for managing add-ins: to install an add-in, all that needs to be done is to copy it to the application's add-ins folder. However, applications may want to offer an user interface for managing add-ins, and even may need to provide an on-line repository from which users can browse and install add-ins. Mono.Addins provides an API and a command line tool which makes it easier to implement add-in management tools in applications.

The mautil command line tool

mautil is a generic command line tool which can be used to manage add-ins of any Mono.Addins based application. It has commands for listing, installing and uninstalling add-ins, registering on-line repositories, and downloading add-ins from those repositories.

For example, to list all add-ins installed for an application, the following command can be used:

> mautil -p /my/app -reg /my/app/reg list

The -p argument specifies the location of the application executable (the directory where the application .exe is located), and the -reg argument specifies the location of the add-in registry for the application (the path provided when calling AddinManager.Initialize).

Creating add-in packages

Add-ins may be composed by several files and assemblies, so in order to make it easier to share, download and install add-ins from on-line repositories add-ins must be packaged. An add-in package is basically a compressed archive (with .mpack extension) which contains all files of an add-in. Add-in packages can be created using the mautil command tool. For example:

> mautil pack SomeAddin.dll

This command will generate a file name SomeAddin.mpack which contains SomeAddin.dll and any other file imported by that add-in. This command can also be used to package add-ins based on manifests:

> mautil pack SomeAddin.addin

Notice that only the main add-in file (either the dll or the manifest) has to be specified. It is important to properly declare assembly and file imports so that those are included in the package.

Creating an add-in repository

An on-line repository of add-ins can be created with some simple steps:
  • Package and copy all add-ins you want to publish to a directory
  • Run the following command (where /the/directory is the directory that contains the add-in packages). This command will generate some index files:
> mautil rep-build /the/directory
  • Make all the files available in an http server

Installing add-ins from a repository

Before installing add-ins from a repository, the repository has to be registered. This can be done using the following command:

> mautil -p /my/app -reg /my/app/reg rep-add http://some.server/some/directory

Available add-ins can be listed using the 'list-av' command:

> mautil -p /my/app -reg /my/app/reg list-av

Once the repository is installed, add-ins can be installed using the 'install' command:

> mautil -p /my/app -reg /my/app/reg install SomeAddin,1.0

Implementing application-specific add-in management tools

Mono.Addins provides an add-in management API which can be easily integrated in applications:
  • The Mono.Addins.Setup.SetupService class (in the Mono.Addins.Setup assembly) provides methods for installing and uninstalling add-ins, with support for dependency resolution.
  • The Mono.Addins.Setup.RepositoryRegistry class (available in SetupService.Repositories) allows registering on-line repositories, and listing available add-ins and add-in updates.
  • The Mono.Addins.Setup.SetupTool class can be used to implement an application-specific command line tool for managing add-ins. This tool will behave like mautil, but it will not be necessary to provide the application and registry paths, and it can be customized to provide application specific commands.
  • The Mono.Addins.Gui assembly provides several classes which implement an add-in manager user interface for GTK# based applications.

Last edited Feb 22, 2011 at 6:54 AM by slluis, version 4


No comments yet.