Save Multiple Folders as a Workspace in VS Code
Working with multiple related projects in Visual Studio Code is made seamless by using multi-root workspaces. This article provides a quick, step-by-step guide on how to combine multiple folders into a single workspace and save it for easy access in the future, allowing you to manage different codebases within a single VS Code window.
Step 1: Open the First Folder
- Launch Visual Studio Code.
- Click on File in the top menu bar (or use the
shortcut
Ctrl+K Ctrl+Oon Windows/Linux, orCmd+Oon macOS). - Select Open Folder… (or Open… on macOS) and choose the first folder you want to include in your workspace.
Step 2: Add Additional Folders
- With the first folder open, go back to the top menu and click on File.
- Select Add Folder to Workspace… from the dropdown menu.
- Browse to and select the next folder you want to add, then click Add.
- Repeat this process for as many folders as you need. You will see all selected folders grouped together in the Explorer sidebar.
Step 3: Save the Workspace Configuration
- Once all your folders are added, click on File in the top menu.
- Select Save Workspace As….
- Choose a directory where you want to store the workspace configuration file.
- Give your workspace a recognizable name and click Save.
VS Code will generate a file with the .code-workspace
extension. This JSON file stores the paths to your folders and any
workspace-specific settings you configure.
How to Open Your Saved Workspace
To reopen your multi-folder setup in the future, you can: *
Double-click the saved .code-workspace file on your
computer. * Open VS Code, go to File > Open
Workspace from File…, and select your saved
.code-workspace file. * Select it from your
File > Open Recent list.