Skip to content

Commit 1e7543e

Browse files
committed
Merged main into live
2 parents 5902dfc + eac787a commit 1e7543e

11 files changed

+138
-68
lines changed

docs/code-quality/roslyn-analyzers-overview.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Analyzers are divided into the following groups:
2424

2525
- [Code style analyzers](/dotnet/fundamentals/code-analysis/code-style-rule-options?preserve-view=true&view=vs-2019#convention-categories)
2626

27-
These analyzers are built into Visual Studio. The analyzer's diagnostic ID, or code format is IDExxxx, for example, IDE0001. You can configure preferences in the [text editor options page](../ide/code-styles-and-code-cleanup.md#code-styles-in-the-options-dialog-box) or in an [EditorConfig file](../ide/create-portable-custom-editor-options.md). Starting in .NET 5.0, code style analyzers are included with the .NET SDK and can be strictly enforced as build warnings or errors. For more information, see [Overview of .NET source code analysis](/dotnet/fundamentals/productivity/code-analysis).
27+
These analyzers are built into Visual Studio. The analyzer's diagnostic ID, or code format is IDExxxx, for example, IDE0001. You can configure preferences in the [text editor options page](../ide/code-styles-and-code-cleanup.md#net-code-styles-in-the-options-dialog-box) or in an [EditorConfig file](../ide/create-portable-custom-editor-options.md). Starting in .NET 5.0, code style analyzers are included with the .NET SDK and can be strictly enforced as build warnings or errors. For more information, see [Overview of .NET source code analysis](/dotnet/fundamentals/productivity/code-analysis).
2828

2929
- [Code quality analyzers](/dotnet/fundamentals/code-analysis/overview#code-quality-analysis)
3030

docs/ide/code-styles-and-code-cleanup.md

Lines changed: 91 additions & 35 deletions
Large diffs are not rendered by default.

docs/ide/create-portable-custom-editor-options.md

Lines changed: 35 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
---
22
title: Define consistent coding styles with EditorConfig
33
description: Add an EditorConfig file to your project or codebase to enforce consistent coding styles for everyone that works in the codebase.
4-
author: mikadumont
5-
ms.author: midumont
4+
ms.date: 05/08/2025
5+
author: mikejo5000
6+
ms.author: mikejo
67
manager: mijacobs
78
ms.subservice: general-ide
89
ms.topic: how-to
910
helpviewer_keywords:
1011
- editorconfig [Visual Studio]
11-
ms.date: 04/01/2024
1212

1313
#customer intent: As a developer, I want to use EditorConfig files to enforce coding style consistency for everyone that writes code in our Visual Studio codebase and projects.
1414

@@ -17,21 +17,13 @@ ms.date: 04/01/2024
1717

1818
To enforce consistent coding styles for everyone that works in a codebase, you can add an `.editorconfig` file to your solution or project. EditorConfig file settings adhere to a file format specification maintained by [EditorConfig.org](https://editorconfig.org). Many code editors and applications support EditorConfig files, including Visual Studio. Because the settings are in a file, they accompany your code, and can be used even outside of Visual Studio.
1919

20-
In Visual Studio, EditorConfig file settings take precedence over the various global text editor settings available under **Tools** > **Options** > **Text Editor** > **C/C++** > **Code Style**. You can use an EditorConfig file to tailor each codebase to use text editor settings that are specific to that project.
20+
In Visual Studio, EditorConfig file settings take precedence over the various global text editor settings available under **Tools** > **Options** > **Text Editor** > **\[C# | C/C++ | Visual Basic\]** > **Code Style**. You can use an EditorConfig file to tailor each codebase to use text editor settings that are specific to that project.
2121

22-
You can manually populate an EditorConfig file, or automatically generate it based on the code style settings you've chosen in Visual Studio. To create a new `.editorconfig` file based on your current Visual Studio settings, from the Visual Studio main menu choose **Tools** > **Options** > **Text Editor** > **C/C++** > **Code Style**. Then choose **Generate .editorconfig file from settings**. Choose the folder where your project is and then choose **Select Folder** to save the `.editorconfig` file.
22+
You can manually populate an EditorConfig file, or automatically generate it based on the code style settings you've chosen in Visual Studio. For more information, see [Ways to add an EditorConfig file](#ways-to-add-an-editorconfig-file).
2323

2424
When you use an EditorConfig file, you can still continue to set your own personal editor preferences in the Visual Studio text editor. These text editor settings apply whenever you're working in a codebase without an EditorConfig file, or when the EditorConfig file doesn't override a particular setting. An example of such a preference is whether to use tabs or spaces for the code indent style.
2525

26-
When you add an EditorConfig file to your project in Visual Studio, only new lines of code are formatted based on the EditorConfig settings. The formatting of existing code isn't changed unless you run one of the following commands:
27-
28-
- [Code Cleanup](../ide/code-styles-and-code-cleanup.md#apply-code-styles).
29-
30-
Select **Code Cleanup** in the Visual Studio editor, or press **Ctrl**+**K**, **Ctrl**+**E**. This command applies to white-space settings, such as indent style, and selected code-style settings, such as parenthesis preferences.
31-
32-
- Format Document.
33-
34-
Select **Edit** > **Advanced** > **Format Document**, or press **Ctrl**+**K**, **Ctrl**+**D** in the default profile. This command applies only to white-space settings, such as indent style.
26+
When you add an EditorConfig file to your project in Visual Studio, only new lines of code are formatted based on the EditorConfig settings. The formatting of existing code isn't changed unless you run the **Code Cleanup** or **Format Document** commands. For more information, see [Apply code styles](../ide/code-styles-and-code-cleanup.md).
3527

3628
## Code consistency
3729

@@ -67,7 +59,35 @@ EditorConfig supports [code style](/dotnet/fundamentals/code-analysis/code-style
6759

6860
When you add an EditorConfig file to your project or codebase, Visual Studio formats any new lines of code you write according to the EditorConfig file settings. However, Visual Studio doesn't convert existing styles to the new ones until you format the document or run [Code Cleanup](../ide/code-styles-and-code-cleanup.md#apply-code-styles). For example, if the indents in your file are formatted with tabs and you add an EditorConfig file that formats indents with spaces, the indent characters aren't automatically converted to spaces. When you format the document (select **Edit** > **Advanced** > **Format Document** or press **Ctrl**+**K**, **Ctrl**+**D**), the white-space settings in the EditorConfig file are applied to existing lines of code.
6961

70-
If you remove an EditorConfig file from your project or codebase, you must close and reopen any open code files for the global editor settings to effect new lines of code.
62+
If you remove an EditorConfig file from your project or codebase, you must close and reopen any open code files for the global editor settings to affect new lines of code.
63+
64+
### Ways to add an EditorConfig file
65+
66+
There are a couple of ways you can add an EditorConfig file to your project:
67+
68+
- [Automatically generate an EditorConfig file based on your code-style settings](../ide/code-styles-and-code-cleanup.md#code-styles-in-editorconfig-files).
69+
70+
- [Manually add the EditorConfig file](#add-an-editorconfig-file-to-a-project).
71+
72+
- Use [IntelliCode for Visual Studio](/visualstudio/ide/intellicode-visual-studio) to generate an `.editorconfig` file in your solution. Right-click in Solution Explorer and choosing **Add** > **New EditorConfig (IntelliCode)** from the context menu. IntelliCode for Visual Studio infers your code styles from existing code, and then creates an EditorConfig file with your code-style preferences predefined.
73+
74+
### Generate an EditorConfig from code-style settings
75+
76+
::: moniker range=">=vs-2022"
77+
78+
You can manually populate your EditorConfig file, or you can automatically generate the file based on the code style settings you've chosen in the Visual Studio **Options** dialog box. This options page is available at **Tools** > **Options** > **Text Editor** > [**C#** | **C/C++** | **Visual Basic**] > **Code Style** > **General**. Click **Generate .editorconfig file from settings** to automatically generate a coding style *.editorconfig* file based on the settings on this **Options** page.
79+
80+
![Screenshot of Generate editorconfig file from settings.](media/vs-2022/generate-editorconfig-file-small.png)
81+
82+
::: moniker-end
83+
84+
::: moniker range="vs-2019"
85+
86+
You can manually populate your EditorConfig file, or you can automatically generate the file based on the code style settings you've chosen in the Visual Studio **Options** dialog box. This options page is available at **Tools** > **Options** > **Text Editor** > [**C#** or **Basic**] > **Code Style** > **General**. Click **Generate .editorconfig file from settings** to automatically generate a coding style *.editorconfig* file based on the settings on this **Options** page.
87+
88+
![Screenshot of Generate editorconfig file from settings.](media/vs-2019/generate-editorconfig-file-small.png)
89+
90+
::: moniker-end
7191

7292
### Add an EditorConfig file to a project
7393

@@ -95,14 +115,6 @@ To add an EditorConfig file to your project or solution, follow these steps:
95115

96116
1. Optionally edit the file, and then save it.
97117

98-
### Other ways to add an EditorConfig file
99-
100-
There are a couple of other ways you can add an EditorConfig file to your project:
101-
102-
- Use [IntelliCode for Visual Studio](/visualstudio/ide/intellicode-visual-studio) to generate an `.editorconfig` file in your solution. Right-click in Solution Explorer and choosing **Add** > **New EditorConfig (IntelliCode)** from the context menu. IntelliCode for Visual Studio infers your code styles from existing code, and then creates an EditorConfig file with your code-style preferences predefined.
103-
104-
- [Automatically generate an EditorConfig file based on your code-style settings](code-styles-and-code-cleanup.md#code-styles-in-editorconfig-files).
105-
106118
## File hierarchy and precedence
107119

108120
When you add an `.editorconfig` file to a folder in your file hierarchy, its settings apply to all applicable files at that level and lower. You can also override EditorConfig settings for a particular project, codebase, or part of a codebase, such that it uses different conventions than other parts of the codebase. Doing so can be useful when you incorporate code from somewhere else, and don’t want to change its conventions.

docs/ide/find-and-fix-code-errors.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ Visual Studio provides [on-demand formatting of your C# code file](code-styles-a
9898

9999
![Screenshot of Code Cleanup button.](media/vs-2019/execute-code-cleanup.png)
100100

101-
In addition to formatting your file for spaces, indents, and so on, **Code Cleanup** also applies a set of code style conventions that you define. Your preferences for each code style are read from the [EditorConfig file](code-styles-and-code-cleanup.md#code-styles-in-editorconfig-files), if you have one for the project, or from the [code style settings](code-styles-and-code-cleanup.md#code-styles-in-the-options-dialog-box) in the **Options** dialog box.
101+
In addition to formatting your file for spaces, indents, and so on, **Code Cleanup** also applies a set of code style conventions that you define. Your preferences for each code style are read from the [EditorConfig file](code-styles-and-code-cleanup.md#code-styles-in-editorconfig-files), if you have one for the project, or from the [code style settings](code-styles-and-code-cleanup.md#net-code-styles-in-the-options-dialog-box) in the **Options** dialog box.
102102

103103
## Debug your running code
104104

68.1 KB
Loading
3.5 KB
Loading

docs/msbuild/errors/msb1013.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ This article describes the MSB1013 error code.
3131
<!-- :::editable-content name="postOutputDescription"::: -->
3232
## Description
3333

34-
Response files are text files that contain command-line switches to be passed to MSBuild.exe. You can use response files to avoid typing the same switches repeatedly. You can just pass in the response file instead. Response files can include the @ switch in order to further include other response files. In order to prevent a circular reference, MSBuild disallows the same response file from being included twice. This error message would be followed by the exact @ switch that resulted in the duplicate response file.
34+
Response files are text files that contain command-line switches to be passed to MSBuild.exe. You can use response files to avoid typing the same switches repeatedly. You can just pass in the response file instead. Response files can include the @ switch in order to further include other response files. In order to prevent a circular reference, MSBuild disallows the same response file from being included twice. This error message would be followed by the exact @ switch that resulted in the duplicate response file. See [MSBuild response files](../msbuild-response-files.md).
3535

3636
## Resolution
3737

docs/msbuild/errors/msb3027.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ This error occurs when MSBuild tries to copy a file repeatedly and fails when th
3232

3333
The standard output message text is followed by additional information from the operating system. Look to the additional information provided to determine the cause of the problem.
3434

35-
Typical causes include the destination file is in use by another program, the permissions to not allow writing to the destination file, not enough space on the drive, or the network drive is not available due to a network or permissions error.
35+
Typical causes include the destination file is in use by another program, the permissions do not allow writing to the destination file, not enough space on the drive, or the network drive is not available due to a network or permissions error.
3636

3737
## Applies to
3838

39-
All versions of MSBuild
39+
All versions of MSBuild

docs/msbuild/errors/msb3553.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ This error occurs when there's a problem with the name of a resource file.
3030

3131
## Resolution
3232

33-
Verify that the file extension corresponds to the file type (for example, `.resx`). Confirm the file doesn't contain any invalid characters as define by the operating system. Refer to your operating system documentation for characters that are invalid in a filename or path. For Windows, see [Naming a file](/windows/win32/fileio/naming-a-file#naming-conventions).
33+
Verify that the file extension corresponds to the file type (for example, `.resx`). Confirm the file doesn't contain any invalid characters as defined by the operating system. Refer to your operating system documentation for characters that are invalid in a filename or path. For Windows, see [Naming a file](/windows/win32/fileio/naming-a-file#naming-conventions).
3434

3535
This error can also occur when file paths exceed the maximum path length. If you use long paths, check the Windows operating system `LongPathsEnabled` setting. For more information, see [Maximum file path limitation](/windows/win32/fileio/maximum-file-path-limitation?tabs=cmd).
3636

3737
## Applies to
3838

39-
All versions of MSBuild
39+
All versions of MSBuild

docs/msbuild/msbuild.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,14 @@ The Microsoft Build Engine is a platform for building applications. This engine,
1717

1818
Visual Studio uses MSBuild to load and build managed projects. The project files in Visual Studio (*.csproj*, *.vbproj*, *.vcxproj*, and others) contain MSBuild XML code that executes when you build a project in the IDE. Visual Studio projects import all the necessary settings and build processes to do typical development work, but you can extend or modify them from within Visual Studio or by using a text editor.
1919

20+
## Install MSBuild
21+
2022
To install MSBuild on a Windows system that doesn't have Visual Studio, go to **Build Tools for Visual Studio** on the [downloads page](https://visualstudio.microsoft.com/downloads/?cid=learn-onpage-download-cta). Installing MSBuild by this method gives you *MSBuild.exe*.
2123

2224
For .NET Core and .NET 5 or later, another way of getting the equivalent to MSBuild is to install the [.NET SDK](/dotnet/core/sdk#acquiring-the-net-sdk). The .NET build command `dotnet build` is available with the .NET SDK on macOS, Windows, or Linux. The .NET build command `dotnet build` is a thin wrapper over the .NET Core version of *MSBuild.exe*. You can use the [.NET Core command-line interface (CLI)](/dotnet/core/tools/), which uses MSBuild, to build projects that target .NET Core and .NET 5 and later.
2325

26+
## About MSBuild
27+
2428
::: moniker range=">=vs-2022"
2529
Starting with Visual Studio 2022, when you build in Visual Studio, the 64-bit version of MSBuild is used.
2630
::: moniker-end

0 commit comments

Comments
 (0)