The Create Packages dialog turns metadata in a Salesforce DX project into Second-Generation Packages, either managed or unlocked, in your Dev Hub. Use Create Packages to break a large org into modular packages that are easier to test and deploy, to create a new version of an application for testing in scratch orgs, or to prepare a managed package for distribution. After a version is created, install the version with the Install Packages dialog.
Video
The video walks through the whole flow: creating a package version with Create Packages, then installing that version with Install Packages.
Before you start
- Install the Salesforce DX command line interface on your computer.
- Add a Developer Project in Salesforce DX format to the desktop, connected to a remote repository or a local folder. Right-click the project and take a snapshot so the project is up to date.
- Connect the project to any Salesforce org with a deployment arrow. The project is the source of the metadata files; the packages are created in the Dev Hub you select.
Opening Create Packages
Right-click the deployment arrow and choose Create Packages, or open the dialog from the Options Menu.
Define Package tab
Use this tab to create a brand-new package. Skip this tab when you only need a new version of an existing package.
- Choose the project path and the Dev Hub.
- Check Create a Second-Generation Package.
- Enter a unique package name, a description, and a namespace.
- Choose the package type. Managed packages must have a namespace; unlocked packages have an optional namespace.
The packages already in the Dev Hub are listed at right. Select one to fill in the fields at left.
Define Version tab
- Check Create a Second-Generation Version.
- Enter the package name: an existing package, or the new package from the first tab.
- Enter a version name, description, and version number. Use the keyword NEXT for the build number to increment automatically, for example 1.0.0.NEXT.
- Optionally add a version tag, a branch, an installation key to protect the version, and a namespace.
The versions already in the Dev Hub are listed at right. Select one to fill in the fields at left.
Create Packages tab
Review the package and version to create, then click Create Packages. Creation can take several minutes. Choose Wait For Completion to wait for the result, or Continue Immediately to submit the request and keep working.
Schedule Create tab
Schedule package creation for a later date and time, for example as part of an overnight build.
Managing Dev Hubs and scratch orgs
Manage Scratch Orgs lists the connected orgs, Dev Hubs, and scratch orgs that Salesforce DX is managing. From there you can add an existing connected org, open an org in your browser, delete a scratch org, or create a new scratch org: choose the Dev Hub, admin email, alias, org name, Salesforce edition, an optional definition file in JSON format, and options such as no package ancestors or no namespace, which is useful for testing managed packages.
Links
Break Your Salesforce Org Into Packages