---
schema_version: "1"
id: 86c5be45a37096a53b7a8b85aaddd7da30f63aa4ad658b598a4dbf3535b79bf6
title: Comparison of First- and 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-comparison.md
canonical_url: https://developer.salesforce.com/docs/platform/pkg2-dev/guide/sfdx-dev-dev2gp-comparison.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 24592ebe0a898020ea24d44d3ec4476341cf8abb46b9a7d543793a23cc9da29b
products:
  - Second-Generation Managed Packaging Developer Guide
  - merged-docs
---

# Comparison of First- and Second-Generation Managed Packages

If you’re familiar with first-generation managed packages (managed 1GP) and wonder how it’s different from second-generation managed packages (managed 2GP), here are some key distinctions.

| Managed 1GP Packages                                                                          | Managed 2GP Packages                                                                                                                                                                                                                                                                                                                                                                                                                             |
| --------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| The packaging org is the source of truth for the metadata in your package.                    | Your version control system is the source of truth (source-driven system) for the metadata in your package. And unlike managed 1GP, managed 2GP doesn’t use packaging or patch orgs.                                                                                                                                                                                                                                                             |
| The packaging org owns the package. The metadata in the package resides in the packaging org. | The Dev Hub owns the package, but the Dev Hub doesn’t contain the packaged metadata. We recommend that you enable Dev Hub in your Partner Business Org (PBO).                                                                                                                                                                                                                                                                                    |
| A packaging org can own only one managed package.                                             | A Dev Hub can own one or more packages.                                                                                                                                                                                                                                                                                                                                                                                                          |
| The namespace of the managed package is created in the packaging org.                         | The namespace of a managed package is created in a namespace org and linked to the Dev Hub. And you can associate multiple namespaces to a single Dev Hub. A namespace is linked to a managed 2GP when you run the `sf package create` Salesforce CLI command. And you must specify the namespace in the `sfdx-project.json` file. See [Namespaces for Second-Generation Managed Packages](https://developer.salesforce.com/docs/platform/pkg2-dev/guide/sfdx-dev-dev2gp-plan-namespaces.md) for more details. |
| A namespace can be associated with only one package.                                          | Multiple packages can use the same namespace.                                                                                                                                                                                                                                                                                                                                                                                                    |
| Global Apex is the only way to share code across packages.                                    | Multiple packages using the same namespace can share code using public Apex classes and methods with the `@namespaceAccessible` annotation.                                                                                                                                                                                                                                                                                                      |
| Some packaging operations, like package create and package uninstall, can’t be automated.     | All packaging operations can be automated using Salesforce CLI.                                                                                                                                                                                                                                                                                                                                                                                  |
| Package versioning is linear.                                                                 | Package versioning is flexible, and you can abandon unwanted package versions. This flexible versioning allows you to use branches and do parallel package development.                                                                                                                                                                                                                                                                          |
| Patch versions can only be created in specialized orgs called patch orgs.                     | Patch versions are created using Salesforce CLI. The version control system is the source of truth, and there are no patch orgs.                                                                                                                                                                                                                                                                                                                 |

Despite these distinctions, managed 1GP and 2GP packages have many things in common. They share the key packaging concept of associating metadata with a package. And they both allow you to iterate and create package and patch versions, which can be installed and uninstalled in subscriber orgs. Both managed package types enable you to submit a package for AgentExchange security review, and list your package on AgentExchange. And both managed package types can use the License Management App, Subscriber Support Console, and Feature Management App.
