---
schema_version: "1"
id: c615303f0ccbda71bb166fb25989bbd8442f1cc7c4f68bd85b0709f5b6a14f32
title: Second-Generation Managed Packages
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/platform-pkg-exchange/managed_packaging/guides/second-generation/sfdx-dev-dev2gp.md
canonical_url: https://developer.salesforce.com/docs/platform/pkg2-dev/guide/sfdx-dev-dev2gp.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 0eb36ea18c65ce51638a8097dff276c5fec2d5c184b963da65f82b55179c65c6
products:
  - Second-Generation Managed Packaging Developer Guide
  - merged-docs
---

# Second-Generation Managed Packages

Second-generation managed packaging (managed 2GP) ushers in a new way for ISV partners to develop, distribute, and manage their apps and metadata. You can use managed 2GP packaging to organize your source, build small modular packages, integrate with your version control system, and better utilize your custom Apex code. With version control being the source of truth, there are no packaging or patch orgs. You can execute all packaging operations via Salesforce CLI, or automate them using scripts. Submit second-generation managed packages for security review, and list them on AgentExchange.

Use managed 2GP to create new managed packages. You can’t currently migrate a first-generation managed package to a second-generation managed package.

Another great way to learn about second-generation managed packages, is by taking the [Second-Generation Managed Packages](https://trailhead.salesforce.com/content/learn/modules/second-generation-managed-packages) Trailhead module.

**note:** Second-generation managed packaging addresses the specific needs of ISV partners. If you’re a customer or system integrator and you don’t plan to distribute a package to multiple customers, unlocked packaging is the preferred tool. You can use unlocked packages to organize your existing metadata, package an app or extension, or package new metadata. See [Unlocked Packages](https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_unlocked_pkg_intro.htm) for more information.

- **[What’s a Second-Generation Managed Package?](https://developer.salesforce.com/docs/platform/pkg2-dev/guide/sfdx-dev-dev2gp-pkg-whats-a-package.md)**


    If your goal is to build an app and distribute it on AgentExchange, you’ll use managed packages to do both. Packaging is the container that you fill with metadata, and it holds the set of related features, customizations, and schema that make up your app. A package can include many different metadata components, and you can package a single component, an app, or library.

- **[Set Up Your Development Environment](https://developer.salesforce.com/docs/platform/pkg2-dev/guide/sfdx-pkg-dev-environment.md)**


    Second-generation managed packaging uses Salesforce DX developer tools. Ensure that you have the required tools and orgs installed and enabled.

- **[Before You Create Second-Generation Managed Packages](https://developer.salesforce.com/docs/platform/pkg2-dev/guide/sfdx-dev-dev2gp-before.md)**


    When you use second-generation managed packaging, to be sure that you set it up correctly, verify the following.

- **[Scratch Orgs and Package Development](https://developer.salesforce.com/docs/platform/pkg2-dev/guide/pd-dev-hub-intro.md)**


    Scratch orgs are temporary Salesforce orgs intended for development and automation. They enable source-driven deployments of Salesforce code and metadata. A scratch org is fully configurable, allowing developers to emulate different Salesforce editions with various features and preferences.

- **[Workflow for Second-Generation Managed Packages](https://developer.salesforce.com/docs/platform/pkg2-dev/guide/sfdx-dev-dev2gp-workflow.md)**


    You can create and install a second-generation managed package (managed 2GP) directly from the command line.

- **[Components Available in Second-Generation Managed Packages](https://developer.salesforce.com/docs/platform/pkg2-dev/guide/packaging-packageable-components.md)**


    Each metadata component that you include in a second-generation managed package has certain rules that determine its behavior in a subscriber org. Manageability rules determine whether you, or the subscriber, can edit or remove components after the package version is created and installed.

- **[Editable Properties After Package Promotion or Installation](https://developer.salesforce.com/docs/platform/pkg2-dev/metadata-components/mdc-editable-property-definitions.md)**


    Certain properties on metadata components are editable after the managed package is installed.

- **[Behavior of Specific Metadata in Second-Generation Managed Packages](https://developer.salesforce.com/docs/platform/pkg2-dev/guide/sfdx-dev-dev2gp-specific-md-details.md)**


    Learn how profiles and namespace visibility are handled for second-generation managed packages.

- **[Develop Second-Generation Managed Packages](https://developer.salesforce.com/docs/platform/pkg2-dev/guide/sfdx-dev-dev-2gp-developing-2gp-packages.md)**


    Ready to get started? Create your first second-generation managed package, and then update and create new versions of your package.

- **[Install and Uninstall Second-Generation Managed Packages](https://developer.salesforce.com/docs/platform/pkg2-dev/guide/sfdx-dev-dev2gp-install-upgrade.md)**


    Use a disposable scratch org to test your second-generation managed packages (managed 2GP). You can install or uninstall a managed 2GP package using a Salesforce CLI command, or from the Setup page. Because you can't upgrade a beta package version, be sure you don't install it in a sandbox that you use in your release pipeline, such as UAT or staging.

- **[Prepare to Distribute Your Second-Generation Managed Package](https://developer.salesforce.com/docs/platform/pkg2-dev/guide/sfdx-dev-dev2gp-distribute-package.md)**


    Before you release a version of your second-generation managed package, ensure that you understand the code coverage requirements, release logistics, and how to publish your app on AgentExchange.

- **[Push a Package Upgrade for Second-Generation Managed Packages](https://developer.salesforce.com/docs/platform/pkg2-dev/guide/push-upgrade-intro-2gp.md)**


    Push upgrades enable you to upgrade second-generation managed packages installed in subscriber orgs, without asking customers to install the upgrade themselves. You can choose which orgs receive a push upgrade, what version the package is upgraded to, and when you want the upgrade to occur. Push upgrades are helpful if you need to push a change for a hot bug fix.

- **[Advanced Features for Second-Generation Managed Packages](https://developer.salesforce.com/docs/platform/pkg2-dev/guide/sfdx-dev-dev2gp-advanced-topics.md)**


    After you're comfortable with creating second-generation managed packages, learn about these advanced features to customize your package development processes.

- **[Best Practices for Second-Generation Managed Packages](https://developer.salesforce.com/docs/platform/pkg2-dev/guide/sfdx-dev-dev2gp-plan-best-practices.md)**


    We suggest that you follow these best practices when working with second-generation managed packages.

- **[Manage Licenses for Managed Packages](https://developer.salesforce.com/docs/platform/pkg2-dev/lma/lma-intro.md)**


    Use the License Management App (LMA) to manage leads and licenses for your AgentExchange solutions. By integrating the LMA into your sales and marketing processes, you can better engage with prospects, retain existing customers, and grow your ISV business. The LMA is a managed package that is installed in all partner business orgs (PBO) and includes custom objects that track details on packages, package versions, and licenses.

- **[Manage Features in Second-Generation Managed Packages](https://developer.salesforce.com/docs/platform/pkg2-dev/guide/sfdx-fma/sfdx-dev-dev2gp-fma-manage-features.md)**


    Take the License Management App (LMA) a step further by extending it with the Feature Management App (FMA).

- **[Get Started with AgentExchange App Analytics](https://developer.salesforce.com/docs/platform/pkg2-dev/guide/appexchange/app-analytics/app-analytics-intro-2gp.md)**


    AgentExchange App Analytics provides usage data about how subscribers interact with your AgentExchange managed packages and packaged components. You can use these details to identify attrition risks, inform feature development decisions, and improve user experience.

- **[Gaps Between First-Generation and Second-Generation Managed Packaging](https://developer.salesforce.com/docs/platform/pkg2-dev/guide/sfdx-dev-dev2gp-known-limitations.md)**


    The following functionality is supported in first-generation managed packaging, and not yet supported in second-generation managed packaging. We’re working to address these feature gaps.
