-
Notifications
You must be signed in to change notification settings - Fork 95
Creating and Managing Add in Packages
Home > Programming Guide > 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.
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).
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.
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
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
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 through the SetupService.Repositories property) 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.
Next topic: Advanced Concepts
- Extension Points and Extensions
- Querying Extension Points
- Type Extension Metadata
- Data-only Extension Points
- Data Files and Resources
- About Lazy Loading
- Thread Safety
- The Add-in Registry
- Addin Discovery
- Creating and Managing Add-in Packages
- Advanced Concepts