diff --git a/docs/ide/develop-code-in-visual-studio-without-projects-or-solutions.md b/docs/ide/develop-code-in-visual-studio-without-projects-or-solutions.md index 364a0f2c1a1..e13d5ddb136 100644 --- a/docs/ide/develop-code-in-visual-studio-without-projects-or-solutions.md +++ b/docs/ide/develop-code-in-visual-studio-without-projects-or-solutions.md @@ -1,7 +1,7 @@ --- title: Develop code without projects or solutions description: Learn how to develop code directly in Visual Studio without a need for projects or solutions. -ms.date: 04/29/2022 +ms.date: 11/7/2023 ms.topic: how-to helpviewer_keywords: - open folder [Visual Studio] @@ -40,6 +40,33 @@ You can open code into Visual Studio in the following ways: - Open code from a cloned GitHub repo. +### To open multiple folders +Starting in Visual Studio 2022 version 17.9 Preview 1, you can specify multiple folders to open in Visual Studio. Opening multiple folders is especially useful in code repos with lots of unrelated code, and a developer only needs a subset to do some work. +- On the Visual Studio menu bar, choose **File** > **Open** > **Workspace**, and then browse to the `.code-workspace` file location. +- The `.code-workspace` file itself is expected to be a .JSON schema, which looks like the following: + +```json +{ + "folders" : [ + { + "path" : "some\\child\\foo", + "name" : "The Foo" + }, + { + "path" : "..\\..\\some\\unrelated\\bar" + }, + { + "path" : "C:\\a\\full\\path\\baz" + }, + { + "path" : "${env.ANY_ENV_VARIABLE}\\foobar" + } + ] +} +``` + +Each `"path"` value can be any relative path or rooted path. Rooted paths must be on the same drive letter. Environment variables can be used with the syntax `${env.ANY_ENV_VARIABLE}`. The `"name"` property can be used to create a visual alias for the folder in the Solution Explorer. + ### To open code from a cloned GitHub repo The following example shows how to clone a GitHub repo and then open its code in Visual Studio. To follow this procedure, you must have a GitHub account and Git for Windows installed on your system. See [Create a GitHub account to use with Visual Studio](../version-control/git-create-github-account.md) and [Git for Windows](https://git-for-windows.github.io/) for more information.