You rarely hand-type a manifest from a blank file. The Salesforce CLI generates one from your source or from an org, and you trim it. Here is how to produce a package.xml you can deploy with.
- Open a project and pick a source
Work inside a Salesforce DX project so the CLI knows your folder layout. Decide whether the manifest should reflect local files in force-app or live metadata in a connected org.
- Generate the manifest
From local source, run sf project generate manifest --source-dir force-app --name package. To capture an org instead, add --from-org with the org alias. The CLI writes a package.xml under the manifest folder.
- Trim the types and members
Open the generated package.xml and remove any types blocks you do not want in this deployment. Replace broad wildcards with explicit member names for a production payload, leaving only the components under review.
- Set the version line
Check the version element near the bottom. Set it to the target org's current API version so the deploy does not fail on an unsupported metadata type.
- Deploy or retrieve with it
Run sf project deploy start -x manifest/package.xml --target-org your-alias to deploy, or sf project retrieve start -x manifest/package.xml to pull the listed components down.
The single XML root element that wraps the whole manifest. Every other element nests inside it.
The API name of a metadata type inside a types block, such as ApexClass or CustomObject. Must match a real Metadata API type.
The specific component to include, or the asterisk wildcard for all components of that type. One types block can hold many members.
The Metadata API version the operation runs under, written as a number like 62.0. Should match a version the target org supports.
- A package.xml only adds and updates. Use a separate destructiveChanges.xml to delete components.
- The asterisk wildcard does not cover every metadata type. Standard objects and some settings must be named explicitly.
- A version higher than the target org supports causes deploy failures on unrecognized types. Match it to the org.
- Generated manifests can include components you did not intend. Always trim the file before a production deploy.