[visual-studio-code] Open multiple Projects/Folders in Visual Studio Code

How do I open multiple projects/folders in a single Visual Studio Code instance, and open multiple files in single view? Does it has any option for future change request?

This question is related to visual-studio-code

The answer is


If you are using unix like OS, you can create a soft link to your target folder.

E.g. I want to see golang source while I am using VSCode. So, I create a soft link to go/src under my project folder.

ln -s /usr/local/go/src gosrc

Hope this helps!


Update: 11/28, 2017

Multi Root Workspaces[0] landed in the stable build, finally. https://code.visualstudio.com/updates/v1_18#_support-for-multi-root-workspaces

[0] https://github.com/Microsoft/vscode/issues/396


It's not possible to open a new instance of Visual Studio Code normally, neither it works if you open the new one as Administrator.

Solution: simply right click on VS Code .exe file, and click "New Window" you can open as many new windows as you want. :)


You can open any folder, so if your projects are in the same tree, just open the folder beneath them.

Otherwise you can open 2 instances of Code as another option


You can use this extension known as Project Manager

In this the projects are saved in a file projects.json, just save the project and by pressing Shift + Alt + P you can see the list of all your saved projects, from there you can easily switch your projects.


Just put your projects in the same folder and simply open that folder in vscode.

Now your projects will appear like:

GROUP OF PROJECTS

  • PROJECT 1

    • Contents
    • Contents
  • PROJECT 2

    • Contents
    • Contents

Or you can just select multiple folders and then click open.

Go to File> Open Folder, then select multiple folders you want to open and click Select Folder


Multiple Folders in VS

Click ->File ->Add Folder to Workplace.

Step 1.

enter image description here

Choose which project to work ->Add(press)

Step 2.

enter image description here


Not sure why the simplest solution is not mentioned. You can simply do File>New Window and open the other project in the new window.


What I suggest for now is to create symlinks in a folder, since VSCode isn't supporting that feature.

First, make a folder called whatever you'd like it to be.

$ mkdir random_project_folder
$ cd random_project_folder
$ ln -s /path/to/folder1/you/want/to/open folder1
$ ln -s /path/to/folder2/you/want/to/open folder2
$ ln -s /path/to/folder3/you/want/to/open folder3
$ code .

And you'll see your folders in the same VSCode window.


October 2017 (version 1.18):

Support for multi-root workspaces is now enabled by default in the Stable release: https://code.visualstudio.com/updates/v1_18#_support-for-multi-root-workspaces

Now we can open multiple folders in one instance, Visual studio code has named as Workspace ("Area de Trabajo"). Take a look at the images, it´s very simple.

enter image description here

enter image description here


You can open up to 3 files in the same view by pressing [CTRL] + [^]


To run one project at a time in same solution

Open Solution explorer window -> Open Solution for Project -> Right click on it -> Select Properties from drop down list (Alt+Enter)-> Common Properties -> select Startup Project you will see "current selection,single selection and multiple selection from that select "Current Selection" this will help you to run one project at a time in same solution workspace having different coding.


Update

This is now available out of the box as of October 2017. From the blog post:

This was our #1 feature request - it's been a while coming but it's here now.

The complete documentation is here.

You can work with multiple project folders in Visual Studio Code with multi-root workspaces. This can be very helpful when you are working on several related projects at one time. For example, you might have a repository with a product's documentation which you like to keep current when you update the product source code.


Original answer

Currently the Insider channel of VSCode gives us this out of the box.

Multi root workspace in vscode

Read more from the blog post.


you can create a workspace and put folders in that : File > save workspace as and drag and drop your folders in saved workspace


You can install the Open Folder Context Menus for VS Code extension from Chris Dias

https://marketplace.visualstudio.com/items?itemName=chrisdias.vscode-opennewinstance

  • Restart Visual Studio Code
  • Right click a folder and select "Open New Workbench Here"

Open New Workbench Here


On Windows it's possible to use mklink to create directory symbolic links to the needed folders. Then keep them together in a folder, and VSCode will list the content of these.

    c:\>mklink /D c:\dev\MyWork\scripts c:\ProjA\scripts
    symbolic link created for c:\dev\MyWork\scripts <<===>> c:\ProjA\scripts

    c:\>mklink /D c:\dev\MyWork\styles c:\ProjB\styles
    symbolic link created for c:\dev\MyWork\styles <<===>> c:\dev\ProjB\styles

This is very similar to @NeilShen's idea, I guess.


Support for multi-root workspaces is now enabled by default in the latest stable release [November 2017 release].

The File > Add Folder to Workspace command brings up an Open Folder dialog to select the new folder.

enter image description here