Salesforce DX Developer Guide
Summer '26 (API version 67.0)
Spring '26 (API version 66.0)
Winter '26 (API version 65.0)
Summer '25 (API version 64.0)
Spring '25 (API version 63.0)
Winter '25 (API version 62.0)
Summer '24 (API version 61.0)
Spring '24 (API version 60.0)
Winter '24 (API version 59.0)
Summer '23 (API version 58.0)
Spring '23 (API version 57.0)
Winter '23 (API version 56.0)
Summer '22 (API version 55.0)
Spring '22 (API version 54.0)
Winter '22 (API version 53.0)
Summer '21 (API version 52.0)
Spring '21 (API version 51.0)
Winter '21 (API version 50.0)
Summer '20 (API version 49.0)
Spring '20 (API version 48.0)
Winter '20 (API version 47.0)
Summer '19 (API version 46.0)
Spring '19 (API version 45.0)
Winter '19 (API version 44.0)
Summer '18 (API version 43.0)
Spring '18 (API version 42.0)
Winter '18 (API version 41.0)
Summer '17 (API version 40.0)
Metadata Coverage
What’s a Package?
Comparison of 2GP and 1GP Managed Packages
Package IDs and Aliases
Workflow for Second-Generation Packages
Best Practices for Second-Generation Managed Packages
Frequently Used Packaging Operations
Generate the Package
Generate a Package Version
Create a Patch Version
Package Ancestors
View Package Ancestry
Package Upgrades in Second-Generation Managed Packaging
Package Connected Apps in Second-Generation Managed Packaging
Code Coverage for 2GP Managed Packages
Release a Second-Generation Managed Package
Update a Package Version
Delete a Package or Package Version
View Package Details
Uninstall a Package
Publishing Your App on AppExchange
Gaps Between First-Generation and Second-Generation Managed Packaging
Test and Respond to the New Order Save Behavior
Limitations for Salesforce DX
Newer Version Available
Create a Package
A package is a top-level container that holds important details about the app or package:
the package name, description, and associated namespace.
You supply the package details when you create a package using Salesforce CLI, and the package descriptor section of your sfdx-project.json project configuration file is automatically updated.
You can associate multiple second-generation managed packages with a single Dev Hub org. Unlike first-generation managed packages, a second-generation package has no packaging org.
-
Generate the Package
When you’re ready to test or share your package, use the force:package:create command to create a package. -
Generate a Package Version
A package version is a fixed snapshot of the package contents and related metadata. The package version lets you manage changes and track what’s different each time you release or deploy a specific set of changes. -
Create a Patch Version
Patch versions of a package are a way to fix small issues with your package without introducing major feature changes. Customers who are using an older version of your package can install a patch and not be forced to upgrade to a new major package version. -
Package Ancestors
2GP managed packages offer the flexibility of branch versioning when developing new package versions. Package ancestry allows you to create a tree-like version structure, and abandon a package version you no longer want to build on. -
View Package Ancestry
Use Salesforce CLI commands to quickly confirm your package’s ancestor, or to create a visualization of the package ancestry tree. -
Package Upgrades in Second-Generation Managed Packaging
Review how package ancestry impacts which package version upgrades are allowed. -
Package Connected Apps in Second-Generation Managed Packaging
Add a connected app to a second-generation managed package. -
Code Coverage for 2GP Managed Packages
Before you can release and distribute a 2GP package version on AppExchange, the Apex code must meet a minimum 75% code coverage requirement. And every Apex Trigger in a package needs test coverage. -
Release a Second-Generation Managed Package
Each new package version is marked as beta when created. As you develop your package, you may create several package versions before you create a version that is ready to be released and distributed. Only released package versions can be listed on AppExchange and installed in customer orgs. -
Update a Package Version
You can update most properties of a package version from the command line. For example, you can change the package version name or description. One important exception is that you can’t change the release status. -
Delete a Package or Package Version
Use the force:package:version:delete and force:package:delete commands to delete packages and package versions that you no longer need. -
View Package Details
View the details of previously created packages and package versions from the command line.