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
|**Introduced version**| Visual Studio 2019 version 16.10 ||
105
-
|**Option values**|`true`| Match namespaces to folder structure |
106
-
||`false`| Do not report on namespaces that do not match folder structure |
107
-
|**Default value**|`true`||
108
-
109
-
Code examples:
110
-
111
-
```csharp
112
-
// dotnet_style_namespace_match_folder = true
113
-
// file path: Example/Convention/C.cs
114
-
usingSystem;
115
-
116
-
namespaceExample.Convention
117
-
{
118
-
classC
119
-
{
120
-
}
121
-
}
122
-
123
-
// dotnet_style_namespace_match_folder = false
124
-
// file path: Example/Convention/C.cs
125
-
usingSystem;
126
-
127
-
namespaceExample
128
-
{
129
-
classC
130
-
{
131
-
}
132
-
}
133
-
```
134
-
135
-
> [!NOTE]
136
-
> `dotnet_style_namespace_match_folder` requires the analyzer to have access to project properties to function correctly. For projects that target .NET Core 3.1 or an earlier version, you must manually add the following items to your project file. (They're added automatically for .NET 5 and later.)
Copy file name to clipboardExpand all lines: docs/fundamentals/code-analysis/style-rules/ide0130.md
+6-5Lines changed: 6 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -44,12 +44,13 @@ Options specify the behavior that you want the rule to enforce. For information
44
44
|**Default option value**|`true`||
45
45
46
46
> [!NOTE]
47
-
> The `dotnet_style_namespace_match_folder` option depends on knowing the current project and root namespace properties. This information is provided by Visual Studio but is not available for command-line builds, such as `dotnet build`. For command-line builds to work, you must add the following properties to your *.editorconfig* file and replace the root directory and namespace placeholders with your values:
47
+
> The `dotnet_style_namespace_match_folder` option depends on knowing the current project and root namespace properties. This information is provided by Visual Studio but is not available for command-line builds, such as `dotnet build`. For command-line builds to work, you must add the following properties to your project file:
0 commit comments