Skip to content
Mikayla Hutchinson edited this page May 15, 2019 · 11 revisions

The MSBuild targets in the MonoDevelop.Addins NuGet facilitate building extension packages. All extension projects should reference this NuGet.

The NuGet handles the mechanics of referencing extension packages and their assemblies, generating extension manifests, and packing extensions into mpack packages.

It adds the following MSBuild items, properties and targets to extension projects:

Items

AddinReference

Adds a dependency on another extension package. The MonoDevelop.Core and MonoDevelop.Ide extension packages are referenced by default. The dependency will be merged into the extension package manifest at build time, and all of the dependency's assemblies will be referenced implicitly.

Optional metadata:

  • Version: overrides the version that is used for the dependency declaration in the manifest. Does not affect what version is used at build time, so be aware that this may cause runtime errors if there are ABI changes.

AddinFile

A file to be included in the extension. It will be automatically copied to the output directory and included in the <Runtime> section of the manifest.

Optional metadata:

  • Link: overrides the relative output path

Core Properties

IsAddin

Whether the project is an extension package. It defaults to true, but may be set to false to build libraries that are not extension packages but can still reference extension assemblies via extension references. It is set automatically by the project templates.

CreatePackage

If this is true, the extension package will be compiled at build time into a .mpack package that can be published and shared with others. This is not intended to be used during development but rather be passed as a commandline argument to MSBuild or set in a release configuration.

InstallAddin

If this is true, the extension package will be installed at build time. This is intended to be passed as a commandline argument to MSBuild and should not be set in the project file.

RunTests

If this is true, then test projects will be run at build time using the MonoDevelop test runner.

Advanced Properties

MDProfileVersion

Used to locate the user's global addin registry in order to resolve extension packages references. The addin registry is installed into versioned directories that changes on major versions.

This value is now determined automatically from the target MD binaries. If an explicit value is provided, it will be checked against the detected value, and an error will be emitted if they do not match.

MDProfilePath

Causes extension packages to be resolved from a profile installed in this directory instead of the user's global addin registry. May also be set using the environment variable MONODEVELOP_TEST_PROFILE.

MDBinDir

The bin directory of the IDE installation against which to build this extension package. If not set, it will be determined automatically from the system-wide installation.

MDAppDir

A convenience property for Macs. If this is set to a VS/MD .app path then MDBinDir will be set to the bin path within that app.

MDConfigDir

The configuration directory that contains the addins-setup.config. If not set, it will be determined from MDProfileVersion and MDProfilePath.

MDAddinsDir

The extension package installation directory. If not set, it will be determined from MDProfileVersion and MDProfilePath.

MDCoreVersionOverride

Changes the version of MonoDevelop that the extension depends on. This can be used, for example, to create an extension package that depends on version 7.0 while actually building against version 7.1. This does not affect which version is used at build time, so be aware that you are responsible for verifying ABI compatibility with the older version.

This affects all extension references where the resolved extension has the same version as its MonoDevelop.Core dependency.

Targets

InstallAddin

Builds a .mpack package for the extension package and installs it.

It is recommended that the $(InstallAddin) property is used instead.

PackageAddin

Builds a .mpack package for the extension package.

It is recommended that the $(CreatePackage) property is used instead.

RunTests

Runs test projects using the MonoDevelop test runner.

It is recommended that the $(RunTests) property is used instead.

Manifest Generation

The build targets automatically generate an extension package manifest called _Manifest.addin.xml in the intermediate output directory and embed it in the extension assembly.

This generated manifest contains a <Runtime> section with <Import> elements for all local copied assembly references and AddinFile items. It also contains a <Dependencies> section with <Dependency> elements for each of the AddinReference items.