You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/ide/outlining.md
+19-21Lines changed: 19 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,8 +1,8 @@
1
1
---
2
-
title: Collapse and expand regions of code
2
+
title: Collapse and Expand Regions of Code
3
3
description: Use the expand and collapse commands in the Visual Studio integrated development environment (IDE) to work in outline mode.
4
-
ms.date: 9/13/2024
5
-
ms.topic: conceptual
4
+
ms.date: 08/25/2025
5
+
ms.topic: concept-article
6
6
helpviewer_keywords:
7
7
- outlining
8
8
- Visual Studio, expand/collapse code
@@ -15,45 +15,43 @@ author: anandmeg
15
15
ms.author: meghaanand
16
16
manager: mijacobs
17
17
ms.subservice: general-ide
18
-
#customer intent: As a developer, I want to understand how to work in outline mode in Visual Studio to improve the ease of writing and maintaining code.
18
+
#customer intent: As a developer, I want to learn how to collapse and expand code in Visual Studio to make it easier to write and maintain code.
19
19
---
20
+
20
21
# Outlining
21
22
22
-
To hide a region of code from view, you can collapse it so that it appears under a caret sign (`>`) in the text editor. Then, to expand a collapsed region, select the caret sign (`>`).
23
+
This article describes the outlining feature in Visual Studio. To hide a region of code from view, you can collapse it so that it appears under a caret sign (`>`) in the code editor. Then, to expand a collapsed region, select the caret sign.
23
24
24
-
> [!TIP]
25
-
> If you are a keyboard user, you can choose **Ctrl**+**M**+**M** to collapse and expand.
25
+
You can also select **Ctrl**+**M**+**M** to collapse and expand code.
26
26
27
27
To collapse an outlining region, double-click any line in the region on the outlining margin, which appears just to the left of the code. You can see the contents of a collapsed region as a tooltip when you hover over the collapsed region.
28
28
29
-
:::image type="content" source="media/outlining-example-2022.png" alt-text="Screenshot of an example of collapsed code that shows the outlining margin and an example of the expanded code visible from a tooltip.":::
29
+
:::image type="content" source="media/outlining-example-2022.png" alt-text="Screenshot of an example of collapsed code that shows the outlining margin and the expanded code visible in a tooltip.":::
30
30
31
-
Regions in the outlining margin are also highlighted when you hover over the margin with the mouse. The default highlighting color might seem rather faint in some color configurations. You can change it in **Tools** > **Options** > **Environment** > **Fonts and Colors** > **Display items** > **Collapsible Region**.
31
+
Regions in the outlining margin are also highlighted when you hover over the margin with the mouse. The default highlighting color might be hard to see in some color configurations. You can change it in **Tools** > **Options** > **Environment** > **Fonts and Colors** > **Display items** > **Collapsible Region**.
32
32
33
-
When you work in outlined code, you can expand the sections you want to work on, collapse them when you're done, and then move to other sections. When you don't want to have outlining displayed, you can use the **Stop Outlining** command to remove the outline information without disturbing your underlying code.
33
+
When you work in outlined code, you can expand the sections you want to work on, collapse them when you're done, and then move to other sections. When you don't want to use outlining, you can use the **Stop Outlining** command to remove the outline information without disturbing your underlying code.
34
34
35
35
The **Undo** and **Redo** commands on the **Edit** menu affect these actions. The **Copy**, **Cut**, **Paste**, and drag-and-drop operations retain outlining information, but not the state of the collapsible region. For example, when you copy a collapsed region, the **Paste** operation pastes the copied text as an expanded region.
36
36
37
37
> [!CAUTION]
38
-
> When you change an outlined region, the outlining might be lost. For example, deletions or **Find and Replace** operations can erase the end of the region.
38
+
> When you change an outlined region, the outlining might be lost. For example, deletions or **Find and Replace** operations can erase the end of a region.
39
39
40
-
The following commands can be found on the **Edit** > **Outlining**submenu.
40
+
You can use these commands from the **Edit** > **Outlining**menu:
41
41
42
-
| Name | Keyboard | Description |
42
+
| Name | Keyboard shortcut | Description |
43
43
|:-----|:---------|:------------|
44
-
| Hide Selection |**Ctrl**+**M**, **Ctrl**+**H**| Collapses a selected block of code that wouldn't normally be available for outlining. Example: an `if` block. To remove the custom region, use **Stop Hiding Current** or **Ctrl**+**M**, **Ctrl**+**U**. Not available in Visual Basic.|
45
-
| Toggle Outlining Expansion |**Ctrl**+**M**, **Ctrl**+**M**| Reverses the current hidden or expanded state of the innermost outlining section when the cursor lies in a nested collapsed section. |
44
+
| Hide Selection |**Ctrl**+**M**, **Ctrl**+**H**| Collapses a selected block of code that wouldn't normally be available for outlining. Example: an `if` block. To remove the custom region, use **Stop Hiding Current** or **Ctrl**+**M**, **Ctrl**+**U**. |
45
+
| Toggle Outlining Expansion |**Ctrl**+**M**, **Ctrl**+**M**| Reverses the current hidden or expanded state of the innermost outlining section when the cursor is in a nested collapsed section. |
46
46
| Toggle All Outlining |**Ctrl**+**M**, **Ctrl**+**L**| Sets all regions to the same collapsed or expanded state. If some regions are expanded and some collapsed, the collapsed regions are expanded.|
47
-
| Stop Outlining |**Ctrl**+**M**, **Ctrl**+**P**| Removes all outlining information for the entire document. To turn it back on, go to **Edit** > **Outlining** and select **Start Automatic Outlining**. |
48
-
| Stop Hiding Current |**Ctrl**+**M**, **Ctrl**+**U**| Removes the outlining information for the currently selected user-defined region. Not available in Visual Basic.|
47
+
| Stop Outlining |**Ctrl**+**M**, **Ctrl**+**P**| Removes all outlining information for the entire document. To turn outlining back on, go to **Edit** > **Outlining** and select **Start Automatic Outlining**. |
48
+
| Stop Hiding Current |**Ctrl**+**M**, **Ctrl**+**U**| Removes the outlining information for the currently selected user-defined region. |
49
49
| Collapse to Definitions |**Ctrl**+**M**, **Ctrl**+**O**| Collapses the members of all types. |
50
-
| Collapse Block:\<logical boundary> || (C++) Collapses a region in the function containing the insertion point. For example, if the insertion point lies inside a loop, the loop is hidden.|
51
-
| Collapse All in: \<logical structures> || (C++) Collapses all the structures inside the function.|
52
50
53
51
> [!TIP]
54
-
> For more information on how to use the keyboard exclusively, see [Keyboard shortcuts in Visual Studio](default-keyboard-shortcuts-in-visual-studio.md).
52
+
> For more information on how to use the keyboard, see [Keyboard shortcuts in Visual Studio](default-keyboard-shortcuts-in-visual-studio.md).
55
53
56
-
You can also use the Visual Studio SDK to define the text regions you want to expand or collapse. See[Walkthrough: Outlining](../extensibility/walkthrough-outlining.md).
54
+
You can also use the Visual Studio SDK to define the text regions that you want to expand or collapse. For more information, see[Walkthrough: Outlining](../extensibility/walkthrough-outlining.md).
Copy file name to clipboardExpand all lines: docs/ide/solutions-and-projects-in-visual-studio.md
+14-25Lines changed: 14 additions & 25 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
---
2
-
title: 'What are Visual Studio solutions & projects?'
3
-
description: Learn about Visual Studio projects and solutions, how to create new projects from a template, and how to view & manage projects in Solution Explorer.
4
-
ms.date: 08/19/2024
2
+
title: What Are Visual Studio Solutions and Projects?
3
+
description: Learn about Visual Studio projects and solutions, how to create new projects from a template, and how to view and manage projects in Solution Explorer.
4
+
ms.date: 08/25/2025
5
5
ms.topic: concept-article
6
6
f1_keywords:
7
7
- vs.openproject
@@ -26,38 +26,38 @@ This article describes the difference between a *project* and a *solution* in Vi
26
26
27
27
## Projects
28
28
29
-
When you create an app or website in Visual Studio, you start with a *project*. In a logical sense, a project contains all files that are compiled into an executable project, library, or website. Those files can include source code, icons, images, data files, and more. A project also contains compiler settings and other configuration files that your program might need to communicate with various services or components.
29
+
When you create an app or website in Visual Studio, you start with a *project*. A project contains all files that are compiled into an executable project, library, or website. Those files can include source code, icons, images, data files, and more. A project also contains compiler settings and other configuration files that your program might need to communicate with various services or components.
30
30
31
31
### Project file
32
32
33
33
Visual Studio uses [MSBuild](../msbuild/msbuild.md) to build each project in a solution, and each project contains an MSBuild project file. The file extension reflects the type of project, for example, a C# project (.csproj), a Visual Basic project (.vbproj), or a database project (.dbproj). The project file is an XML document that contains all the information and instructions that MSBuild needs to build your project. Such information and instructions include the content, platform requirements, versioning information, web server or database server settings, and the tasks to perform.
34
34
35
35
::: moniker range=">=vs-2022"
36
36
37
-
Project files are based on the [MSBuild XML schema](../msbuild/msbuild-project-file-schema-reference.md). To look at the contents of newer, [SDK-style project files](../msbuild/how-to-use-project-sdk.md) in Visual Studio, right-click the [project node](use-solution-explorer.md#solution-explorer-ui) in **Solution Explorer** and select **Edit Project File**. To look at the contents of .NET projects, first unload the project (right-click the project node in **Solution Explorer** and select **Unload Project**). Then, right-click the project and select **Edit Project File**.
37
+
Project files are based on the [MSBuild XML schema](../msbuild/msbuild-project-file-schema-reference.md). To look at the contents of newer, [SDK-style project files](../msbuild/how-to-use-project-sdk.md) in Visual Studio, right-click the [project node](use-solution-explorer.md#solution-explorer-ui) in Solution Explorer and select **Edit Project File**. To look at the contents of .NET projects, first unload the project. (Right-click the project node in Solution Explorer and select **Unload Project**.) Then right-click the project and select **Edit Project File**.
38
38
39
39
::: moniker-end
40
40
41
41
::: moniker range="=vs-2019"
42
42
43
-
Project files are based on the [MSBuild XML schema](../msbuild/msbuild-project-file-schema-reference.md). To look at the contents of newer, [SDK-style project files](../msbuild/how-to-use-project-sdk.md) in Visual Studio, right-click the [project node](use-solution-explorer.md#solution-explorer-ui) in **Solution Explorer** and select **Edit \<projectname\>**. To look at the contents of .NET projects, first unload the project (right-click the project node in **Solution Explorer** and select **Unload Project**). Then, right-click the project and choose**Edit \<projectname\>**.
43
+
Project files are based on the [MSBuild XML schema](../msbuild/msbuild-project-file-schema-reference.md). To look at the contents of newer, [SDK-style project files](../msbuild/how-to-use-project-sdk.md) in Visual Studio, right-click the [project node](use-solution-explorer.md#solution-explorer-ui) in Solution Explorer and select **Edit \<projectname\>**. To look at the contents of .NET projects, first unload the project. (Right-click the project node in Solution Explorer and select **Unload Project**.) Then right-click the project and select**Edit \<projectname\>**.
44
44
45
45
::: moniker-end
46
46
47
47
> [!NOTE]
48
48
> You don't have to use solutions or projects in Visual Studio to edit, build, and debug code. You can simply open the folder that contains your source files in Visual Studio and start editing. For more information, see [Develop code in Visual Studio without projects or solutions](develop-code-in-visual-studio-without-projects-or-solutions.md).
49
49
50
-
### Create new projects
50
+
### Create projects
51
51
52
52
The easiest way to create a new project is to use a project template for the project type you want. A project template includes a basic set of pregenerated code files, config files, assets, and settings. Use **File** > **New** > **Project** to select a project template. For more information, see [Create a new project in Visual Studio](create-new-project.md).
53
53
54
54
You can also create a custom project template that you can use to create new projects from. For more information, see [Create project templates](how-to-create-project-templates.md).
55
55
56
-
When you create a new project, Visual Studio saves it to the default location, *%USERPROFILE%\source\repos*. To change the default location, go to **Tools** > **Options** > **Projects and Solutions** > **Locations**. For more information, see [Options dialog box: Projects and Solutions > Locations](reference/projects-solutions-locations-options.md).
56
+
When you create a project, Visual Studio saves it to the default location, *%USERPROFILE%\source\repos*. To change the default location, go to **Tools** > **Options** > **Projects and Solutions** > **Locations**. For more information, see [Options dialog box: Projects and Solutions > Locations](reference/projects-solutions-locations-options.md).
57
57
58
58
## Solutions
59
59
60
-
A project is contained within a *solution*. Despite its name, a solution isn't an "answer." It's simply a container for one or more related projects, along with build information, Visual Studio window settings, and any miscellaneous files that aren't associated with a particular project.
60
+
A project is contained in a *solution*. Despite its name, a solution isn't an "answer." It's simply a container for one or more related projects, along with build information, Visual Studio window settings, and any miscellaneous files that aren't associated with a particular project.
61
61
62
62
### Solution file
63
63
@@ -68,26 +68,15 @@ Visual Studio uses two file types (*.sln* and *.suo*) to store settings for solu
68
68
|.sln|Visual Studio Solution|Organizes projects, project items, and solution items in the solution.|
69
69
|.suo|Solution User Options|Stores user-level settings and customizations, such as breakpoints.|
70
70
71
-
::: moniker range=">=vs-2022"
72
-
73
-
> [!IMPORTANT]
74
-
> A solution is described by a text file (extension *.sln*) that has its own unique format; it's not intended to be edited by hand. Conversely, the *.suo* file is a hidden file that isn't displayed under the default File Explorer settings. To show hidden files, on the **View** menu in File Explorer, select **Show** > **Hidden items**.
75
-
76
-
::: moniker-end
77
-
78
-
::: moniker range="=vs-2019"
79
-
80
71
> [!IMPORTANT]
81
-
> A solution is described by a text file (extension *.sln*) with its own unique format; it's not intended to be edited by hand. Conversely, the *.suo* file is a hidden file that is not displayed under the default File Explorer settings. To show hidden files, on the **View** menu in File Explorer, select the **Hidden Items** checkbox.
82
-
83
-
::: moniker-end
72
+
> A solution is described by a text file (extension *.sln*) that has its own unique format. It's not intended to be edited manually. Conversely, the *.suo* file is a hidden file that isn't displayed under the default File Explorer settings. To show hidden files, on the **View** menu in File Explorer, select **Show** > **Hidden items**.
84
73
85
74
### Solution folder
86
75
87
-
A *solution folder* is a virtual folder that exists only in Solution Explorer, where you can use it to group projects in a solution. If you want to locate a solution file on a computer, go to **Tools** > **Options** > **Projects and Solutions** > **Locations**. For more information, see [Options dialog box: Projects and Solutions > Locations](reference/projects-solutions-locations-options.md).
76
+
A *solution folder* is a virtual folder that exists only in Solution Explorer, where you can use it to group projects in a solution. If you want to find the location of solution files on a computer, go to **Tools** > **Options** > **Projects and Solutions** > **Locations**. For more information, see [Options dialog box: Projects and Solutions > Locations](reference/projects-solutions-locations-options.md).
88
77
89
78
> [!TIP]
90
-
> To construct a project and solution as an exercise, see [Introduction to projects and solutions](../get-started/tutorial-projects-solutions.md).
79
+
> If you want to construct a project and solution as an exercise, see [Introduction to projects and solutions](../get-started/tutorial-projects-solutions.md).
91
80
92
81
## Solution Explorer
93
82
@@ -111,14 +100,14 @@ Many menu commands are available from the [right-click context menu](use-solutio
111
100
112
101
::: moniker range=">=vs-2022"
113
102
114
-
Starting with [version 17.7](/visualstudio/releases/2022/release-notes), you can also compare files in Solution Explorer by using the right-click context menu options. For more information, see [The file comparison tool](use-solution-explorer.md#the-file-comparison-tool) in [Learn about Solution Explorer](use-solution-explorer.md).
103
+
Starting with [version 17.7](/visualstudio/releases/2022/release-notes-v17.7), you can also compare files in Solution Explorer by using the right-click context menu options. For more information, see [The file comparison tool](use-solution-explorer.md#the-file-comparison-tool) in [Learn about Solution Explorer](use-solution-explorer.md).
115
104
116
105
::: moniker-end
117
106
118
107
For ASP.NET Core projects, you can customize how files are nested in Solution Explorer. For more information, see [File nesting in Solution Explorer](file-nesting-solution-explorer.md).
119
108
120
109
> [!TIP]
121
-
> If you close Solution Explorer and want to open it again, select **View** > **Solution Explorer**on the menu bar, or select **Ctrl**+**Alt**+**L**. If you close side tabs and want to restore them to their default locations, select **Window** > **Reset Window Layout**on the menu bar.
110
+
> If you close Solution Explorer and want to open it again, select **View** > **Solution Explorer**in the top menu, or select **Ctrl**+**Alt**+**L**. If you close side tabs and want to restore them to their default locations, select **Window** > **Reset Window Layout**in the top menu.
122
111
123
112
> [!NOTE]
124
113
> To view the application images and icons that appear in Visual Studio, download the [Visual Studio Image Library](https://www.microsoft.com/download/details.aspx?id=35825).
0 commit comments