Skip to content
This repository has been archived by the owner on Sep 4, 2024. It is now read-only.

Files included in an add in

slluis edited this page Nov 20, 2014 · 3 revisions
Home > Reference Manual > Description of Add ins and Add in Roots > Files included in an add-in

An add-in may be composed by several assemblies and data files. Those files must be declared in the main assembly using custom attributes, or in the XML manifest.

It is important to properly declare all files used by an add-in. For example, when a type from the add-in is required (e.g. an ICommand implementation), only properly declared assemblies will be checked. This information is also used by setup tools to know exactly what needs to be packaged when creating an add-in package.

Declaration using custom attributes

Assemblies can be included using the Mono.Addins.ImportAddinAssembly attribute, and data files using Mono.Addins.ImportAddinFile:

[assembly:ImportAddinAssembly ("AdditionalAssembly.dll")]
[assembly:ImportAddinAssembly ("SupportLibrary.dll", Scan=false)]
[assembly:ImportAddinFile ("SomeData.xml")]

The Scan property can be set to false in [ImportAddinAssembly] attributes to specify that the included assembly has to be ignored by the add-in scanner (so it won't be considered for importing extensions or extension points). The default value is true.

Declaration using an XML manifest

File and assembly imports are declared inside the Runtime element:

<Addin 	namespace="TextEditor" id="Core" version="1.0" isroot="true">
	...
	<Runtime>
		<Import assembly="TextEditor.exe" />
		<Import assembly="TextEditorLib.dll" />
		<Import file="license.txt" />
		...
		<ScanExclude path="SomeLib.dll" />
		<ScanExclude path="someDirectory" />
		...
	</Runtime>
	...
</Addin>

The following table describes the attributes and elements shown above:

XML Description
/Addin/Runtime Contains the list of files.
/Addin/Runtime/Import/@assembly Declares that an assembly belongs to the add-in.
/Addin/Runtime/Import/@file Declares that a file belongs to the add-in.
/Addin/Runtime/ScanExclude Declares that a file or directory must be ignored by the add-in scanner.

Notice that an assembly can be imported using the Import element and at the same time excluded from the scan using ScanExclude. This is useful when the assembly doesn't contain any add-in declaration, but it is still needed since it implements some add-in logic.

Clone this wiki locally