Package and publish a custom extension

Package a custom extension as a .nupkg file with NuGet, then deploy it in CAST Imaging or publish it on CAST Extend for other users
Updated

Overview

A custom extension is distributed as a .nupkg file, a NuGet package built from the extension folder. You can deploy the package in your own CAST Imaging installation, publish it on CAST Extend external link so that other CAST users can download it, or both. This page explains how to build the package, publish it and manage it once published.

Step 1 - Prepare the extension folder

Name the folder after the id of the extension, for example com.castsoftware.uc.nameoftheextension. See Contributor types. The folder contains:

Share an add-on

Any file that enhances CAST Imaging can be shared as an extension, for example a script, a custom assessment model or a set of rules. Copy the file into the extension folder next to plugin.nuspec. For example, a folder com.castsoftware.uc.my_assessment_model that contains:

  • my_assessment_model.pmx
  • plugin.nuspec

CAST Imaging does not install such files: the extension is a convenient way to distribute them, and users copy them where they need them.

Step 2 - Build the .nupkg file

Build the package with the NuGet command-line tool, nuget.exe, which you can download from nuget.org external link. Run it from the folder that contains the extension folder, not from inside it. For example, in a batch file:

set EnableNugetPackageRestore=true
nuget.exe pack com.castsoftware.uc.nameoftheextension\plugin.nuspec

The command creates com.castsoftware.uc.nameoftheextension.<version>.nupkg, where <version> is the value of the version element in plugin.nuspec.

Step 3 - Deploy or publish the package

  • To use the extension in your own CAST Imaging installation, upload the .nupkg file in the Custom extensions tab of the Admin center: see Deploy custom extensions. Use this to test the extension before you publish it.
  • To share the extension with other CAST users, publish it on CAST Extend as described below.

Publish on CAST Extend

Before you publish

  • You need a CAST Extend external link account. Every account can publish User Community extensions. To publish a CAST Labs extension, your account must also be granted the CAST Labs contributor type: see Contributor types.
  • The contributor type must be the same in the folder name, the id element and the authors element of plugin.nuspec.
  • The extension must meet the prerequisites: public GitHub repository, licence and documentation.
  • If the extension uses IDs, reserve them first: see Reserve ID ranges.

CAST Extend accepts only .nupkg files, and rejects packages whose plugin.nuspec does not meet the requirements.

Upload the package

You can upload the package on the CAST Extend website or from the command line.

To upload on the website:

  1. Sign in to CAST Extend external link.

  2. Click your avatar in the top right corner, then Profile.

  3. Open the Publications tab.

  4. Click New Publication and select the .nupkg file.

To upload from the command line, run nuget.exe push from the folder that contains the package, with the API key shown in your CAST Extend profile:

nuget.exe push com.castsoftware.uc.nameoftheextension.1.0.0.nupkg <api_key> -Source https://extend.castsoftware.com/api/package
Parameter Description
com.castsoftware.uc.nameoftheextension.1.0.0.nupkg The path of the package to upload.
<api_key> Your CAST Extend API key, which identifies you as a registered user.
-Source The CAST Extend package URL.

See the nuget push reference external link for the other options. A successful upload ends with Your package was pushed.

If the package meets the requirements, it is accepted. It is not yet visible to other users: it is listed as unlisted until it is validated.

Validation

A CAST Extend user with the Moderator right must validate the extension before other users can download it. The moderator downloads the extension, checks that it meets the requirements, then validates or rejects it. Moderators see a Moderation menu in their profile.

Manage your published extensions

As the owner of an extension you published, you can:

  • see your unlisted extensions, which have been uploaded but not yet validated, in the Publications tab of your profile
  • delete an extension: in the Publications tab, find the extension and click Delete