Skip to main content

Get packages

To get a list of packages, use the AllPackages property of the IMetamodels object.

public void GetAllPackages(ICommandContext c, ICommandParams p) 
{
//Get metamodels
IMetamodels metamodels = c.App.Workspace.CurrentProject.Profile.Metamodels;

//Get all packages
IPackageCollection packages = metamodels.AllPackages;

//Print the display name of the package
foreach (var package in packages)
{
c.App.Output.WriteLine("sample", $"Package: {package.DisplayName}");
}
}