Create a Salesforce DX Project

In this exercise, you will…

  • Create a directory to hold our Salesforce DX projects
  • Use the Salesforce CLI to create a new Salesforce DX project
  • Enter the Salesforce DX project folder to see what files were created

Create a directory to hold our Salesforce DX projects

It’s often a good idea to have a directory on your computer where you can organize all of your Salesforce DX projects.

For that reason, we’ll start by creating a special sfdx-workshop directory in your computer’s “home” directory.

Note for Windows Users: The examples in this exercise use the ~ symbol as a shorthand for the /Users/username/ home directory on MacOS and Linux systems. If you are a Windows user using PowerShell, this command should work. Otherwise, you can substitute %userprofile%/ for ~/ in the following commands.

Execute this command (1 of 2):

mkdir ~/sfdx-workshop

Then execute this command (2 of 2):

cd ~/sfdx-workshop

After executing the above, your terminal should look something like this:

Use the Salesforce CLI to create a new Salesforce DX project

A Salesforce DX project is just a collection of files and directories kept locally, on your computer. By using the force:project:create command, you can get the Salesforce CLI to create boilerplate versions of these files for you.

Execute this command to create an empty Salesforce DX project:

sfdx force:project:create -n my-managed-package
Salesforce DX Command / Flags Description
force:project:create Creates a Salesforce DX project in the specified directory or the current working directory. The command creates the necessary configuration files and folders.
-n (--projectname) The name for the new project. Any valid folder name is accepted.

After executing the above, your terminal should look something like this:

Enter the Salesforce DX project folder to see what files were created

Change into the my-managed-package directory so you can list the files and directories that were just created by the Salesforce CLI.

Execute this command (1 of 2):

cd my-managed-package

Then execute this command (2 of 2):

Note for Windows Users: You can use dir instead of ls -l

ls -l

After executing the above, your terminal should look something like this:

Updated: