# Create an Unlocked/Managed Package

### What’s a Package? <a href="#whats-a-package" id="whats-a-package"></a>

A **package** is a container of related metadata—features, customizations, and schema—that you move from one [Salesforce org](https://knowledgebase.autorabit.com/product-guides/arm/arm-features/salesforce-dx/broken-reference) to another.

There are two kinds:

* **Unlocked packages** – ideal for internal development; they let you add, edit, and remove metadata across multiple orgs in a traceable way.
* **Managed packages** – created by Salesforce partners to distribute or sell apps. They bundle code and configuration into a single, versioned unit.

***

### Create a Package <a href="#create-a-package" id="create-a-package"></a>

Creating a package involves two steps:

1. **Create the package** – define static info such as the name and description.
2. **Create a package version** – the deployable artifact you install in any org.

***

#### Step 1: Create a Package <a href="#step-1-creating-a-package" id="step-1-creating-a-package"></a>

1. Hover over **Salesforce DX** and select **Packages**.
2. Click **Create Package**.
3. Enter a **Package Name** and **Package Description**.
4. Choose **Package Type:** *Unlocked* or *Managed*.
5. Select the **Dev Hub** that owns the package.
6. Choose the **Version Control Repository** and **Branch**.
7. Pick the **Package Directory**.

<figure><img src="https://1912836914-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9vAxMuDrkUkB4OXlH9CL%2Fuploads%2F8666wUy3vznro80oidcF%2Fimage.png?alt=media&#x26;token=e195a2b8-29ff-4981-8178-e9bc32a03b51" alt="Create Package form fields"><figcaption></figcaption></figure>

***

#### Step 2: Create a Package Version <a href="#step-2-create-a-package-version" id="step-2-create-a-package-version"></a>

A **package version** is an immutable snapshot of the metadata in your package. You can install it in scratch orgs, sandboxes, or production.

Fill in the **Package Version** section:

1. **Version Name** – auto-generated from the package name (editable).
2. **Version Description** – brief summary.
3. **Version Number** – format **major.minor.patch.build** (e.g., `1.2.3.4`).

   <div data-gb-custom-block data-tag="hint" data-style="info" class="hint hint-info"><p>The version must contain <strong>four</strong> dot-separated numbers. Any other format causes an error.</p></div>
4. **Installation Key** – optional password to protect the package.
5. **Tag** – release label such as `Release 1.0.0`.

<figure><img src="https://1912836914-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9vAxMuDrkUkB4OXlH9CL%2Fuploads%2FbxQ2nKabOJ9BxKVns0iO%2Fimage.png?alt=media&#x26;token=ff9c217b-53f2-4e4b-afcd-bfbc7cd115d3" alt="Package Version details"><figcaption></figcaption></figure>

***

**Package Dependencies**

If the Dev Hub owns other packages, they appear here.

* Move items between lists with
  * ![Add dependency](https://1912836914-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9vAxMuDrkUkB4OXlH9CL%2Fuploads%2FQUmdogWeS9RA9e0xocP1%2Fimage.png?alt=media\&token=5fe40a2f-190e-4689-9042-fb46a5725bb6) and ![Remove dependency](https://1912836914-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9vAxMuDrkUkB4OXlH9CL%2Fuploads%2F3siQpR0RCgjLlWya4u8O%2Fimage.png?alt=media\&token=dfdbaef8-139f-4d54-9318-f37297e63e1d)
* Re-order with
  * ![Move up](https://1912836914-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9vAxMuDrkUkB4OXlH9CL%2Fuploads%2F8rQPD8adALCQ3mX9sNpD%2Fimage.png?alt=media\&token=f89aa3dc-b207-40a1-bbe5-51657b1cd5b1) and ![Move down](https://1912836914-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9vAxMuDrkUkB4OXlH9CL%2Fuploads%2F1KuiaO5nnXSkIqJWdS7r%2Fimage.png?alt=media\&token=1db71db4-b3c1-4efe-9177-c8af72280552)

<figure><img src="https://1912836914-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9vAxMuDrkUkB4OXlH9CL%2Fuploads%2FU0vE4I3Wbf4hxMozy10k%2Fimage.png?alt=media&#x26;token=8e1976d8-d661-406d-853c-d858584b1b8f" alt="Package Dependencies list"><figcaption></figcaption></figure>

***

Click **View Metadata** or **Create Package**:

* **View Metadata** – review the metadata pulled from VCS before creating.

  <figure><img src="https://1912836914-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9vAxMuDrkUkB4OXlH9CL%2Fuploads%2FGNFUAqhWBfAmUjkQHT49%2Fimage.png?alt=media&#x26;token=44319c72-a0b4-4f1e-b269-9fcc33442d51" alt="View Metadata list"><figcaption></figcaption></figure>
* **Create Package** – create the package with the specified data.

Progress appears on the **Unlocked Package** home screen.

<figure><img src="https://1912836914-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9vAxMuDrkUkB4OXlH9CL%2Fuploads%2FOmZ4XarbEwyMgQh0JKab%2Fimage.png?alt=media&#x26;token=47f1e490-eb3d-485b-9214-eebfbb41db34" alt="Package home progress"><figcaption></figcaption></figure>

<figure><img src="https://1912836914-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9vAxMuDrkUkB4OXlH9CL%2Fuploads%2FvzbBQ2WSp83h2I0HOu4O%2Fimage.png?alt=media&#x26;token=07486413-4d04-4570-af5d-a290f516cb23" alt="Package progress details"><figcaption></figcaption></figure>

***

### More Information on the Package Screen <a href="#more-information-on-the-package-screen" id="more-information-on-the-package-screen"></a>

<figure><img src="https://1912836914-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9vAxMuDrkUkB4OXlH9CL%2Fuploads%2F9TrhvjGM2677hrCWZZ59%2Fimage.png?alt=media&#x26;token=69d395eb-e842-4e5e-97ad-63beb3fb7a64" alt="Package management screen"><figcaption></figcaption></figure>

1. **Status** – view success/failure and download the log.
2. **Actions**
   * **Delete Package** – permanently removes the package.
   * **Create Version** ![Plus icon](https://1912836914-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9vAxMuDrkUkB4OXlH9CL%2Fuploads%2FQUmdogWeS9RA9e0xocP1%2Fimage.png?alt=media\&token=5fe40a2f-190e-4689-9042-fb46a5725bb6) – add a new version.
3. **Info** – hover for package metadata.

**View Packaged Versions** ![View versions icon](https://1912836914-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9vAxMuDrkUkB4OXlH9CL%2Fuploads%2FrI1eWkeV3BheqkNGrjQ7%2Fimage.png?alt=media\&token=7a8c5a9d-782a-4cb3-ab66-b8436de28760) – shows each version’s details.

<figure><img src="https://1912836914-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9vAxMuDrkUkB4OXlH9CL%2Fuploads%2FX3Tv7tBslfuJ192kX2rn%2Fimage.png?alt=media&#x26;token=ea2c2179-236a-470b-823f-294559de78db" alt="Packaged version details"><figcaption></figcaption></figure>

{% hint style="info" %}
**Important Notes**

1. For *unlocked* packages, the latest promoted version is used as the ancestor.
2. For *managed* packages:

   * If no ancestor chosen, the latest promoted version is selected.
   * Selecting **None** creates a version without an ancestor.
   * To choose a non-latest ancestor, tick **Skip Ancestor Check**.

   <figure><img src="https://1912836914-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9vAxMuDrkUkB4OXlH9CL%2Fuploads%2FUlAkpm79b6aIoWXkYZj1%2Fimage.png?alt=media&#x26;token=097ac6fe-2986-4f97-b381-c940f3d227ec" alt="Skip ancestor check option"><figcaption></figcaption></figure>
3. Non-linear versioning in the same branch is restricted.
   {% endhint %}

***

#### Promote

Promote a package version to make it installable outside scratch orgs.\
You may promote only **once** per version number.

{% hint style="info" %}

* Code coverage must be **≥ 75 %** for promotion.
* Older versions created before code-coverage checks show **0 %** but remain unaffected.
  {% endhint %}

***

#### Package Info Tooltip

Hover the info icon to see author, timestamps, and last-modified details.

<figure><img src="https://1912836914-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9vAxMuDrkUkB4OXlH9CL%2Fuploads%2FhrRzjHjOAdyPquw45D3v%2Fimage.png?alt=media&#x26;token=bd49adf0-c165-4af4-bff2-61ec491ee014" alt="Package information tooltip"><figcaption></figcaption></figure>
