Newer Version Available
Create a Salesforce DX Project from Existing Source
-
Create a Salesforce DX project.
1sf project generate --name MyProject -
Change to the project directory.
1cd MyProject -
Retrieve your source by running the project retrieve
start command. The location and format of your current source determine the command
flags you must use.
Format and Location of Current Source Command To Retrieve Your Source You’re a partner who has your source already defined as a managed package in your packaging org. 1sf project retrieve start --package-name <package-name> --target-org <sourceOrg-username-or-alias>The --target-org flag specifies the username or alias for the source org (such as a packaging org) from which you’re retrieving the source. The --package-name flag specifies the package name; if the name contains a space, enclose it in double quotes.
By default, the command creates a package directory, with the same name as your package, in the DX project directory. The command then retrieves the source from your package and organizes it in the new directory using the standard DX source format structure. Use the --output-dir to specify a different directory; the command creates the directory if it doesn’t exist.
You have a manifest file, typically called package.xml, that defines your unpackaged source in a sandbox or production org. 1sf project retrieve start --manifest <manifest-file> --target-org <sourceOrg-username-or-alias>The --target-org flag specifies the username or alias for the org (such as a sandbox or production) from which you’re retrieving the source. The --manifest flag indicates the path to the manifest file, typically called package.xml.
By default, the command retrieves the source into the existing force-app package directory of your DX project Use the --output-dir to specify a different directory; the command creates the directory if it doesn’t exist.
- If the retrieve created a package directory in your project, add it to your sfdx-project.json file.
1sf project generate manifest --from-org prod-orgSee the command help for more examples and information.
1sf project generate manifest --helpYou can also refer to Sample package.xml Manifest Files in the Metadata API Developer Guide.