How To: Create an Extension Plugin
- Ian Christopher (Deactivated)
In this example, we will create an extension plugin and publish it to NuGet feed, which can then be placed in the plugin folder of a pre-deployed ODS / API to extend it.
Before you begin:
- This walkthrough assumes you have a working extension project.
- This article uses the student transportation extension as an example.
- This example assumes you have the NuGet CLI tool. You can follow the instructions for Installing NuGet Client Tools.
- This example assumes you have access to a MyGet feed.
- If you don't have a MyGet feed, you can follow MyGet's instructions for Getting Started with NuGet.
- Alternatively, you can also work with other cost-effective options for distributing software packages such as Azure Artifacts, GitHub Packages, and so forth.
The steps can be summarized as:
Each step is outlined in detail, below.
Creating Extension Plugins
Step 1. Run CodeGen
This step is optional. If you have followed through How To: Extend the Ed-Fi ODS / API - Student Transportation Example and have run initdev, code generation is already completed.
After creating your extension project by following the example on How To: Extend the Ed-Fi ODS / API - Student Transportation Example,
Open a PowerShell session and navigate to Ed-Fi-ODS-Implementation folder and execute the following command to run code generation.
|
Step 2. Build Your Extension Project
From a PowerShell session, run the following command to build your extension project. If you followed the example on How To: Extend the Ed-Fi ODS / API - Student Transportation Example to create the EdFi.Ods.Extensions.SampleStudentTransportation project, your extension will be in Ed-Fi-ODS-Implementation\Application folder.
|
Step 3. Create a NuGet Package
Go to the location of NuGet.exe in your system and execute the following command in a command prompt. Make sure to update the contents of the nuspec file with your information. It is recommended that you version your extension package with the same version as the ODS / API for which it was built.
NuGet.exe pack <source directory>\Ed-Fi-ODS-Implementation\Application\EdFi.Ods.Extensions.SampleStudentTransportation\EdFi.Ods.Extensions.SampleStudentTransportation.nuspec -OutputDirectory <output directory> -Properties configuration=release -NoPackageAnalysis -NoDefaultExcludes
Step 4. Publish NuGet Package
In this step, execute the following command to publish NuGet package.
NuGet.exe push -source https://pkgs.dev.azure.com/ed-fi-alliance/Ed-Fi-Alliance-OSS/_packaging/EdFi/nuget/v3/index.json -apikey <PAT> <nuget directory>\EdFi.Ods.Extensions.SampleStudentTransportation.1.0.0.nupkg
Consuming Extension Plugins
Follow the approach described in How To: Deploy an Extension Plugin to consume the published extension package.