Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions docs/azure/includes/dotnet-all.md
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@
| Microsoft.Azure.Functions.Worker.Extensions.EventHubs | NuGet [5.1.0](https://www.nuget.org/packages/Microsoft.Azure.Functions.Worker.Extensions.EventHubs/5.1.0) | | |
| Microsoft.Azure.Functions.Worker.Extensions.Http | NuGet [3.0.13](https://www.nuget.org/packages/Microsoft.Azure.Functions.Worker.Extensions.Http/3.0.13) | | |
| Microsoft.Azure.Functions.Worker.Extensions.Kafka | NuGet [3.6.0](https://www.nuget.org/packages/Microsoft.Azure.Functions.Worker.Extensions.Kafka/3.6.0) | | |
| Microsoft.Azure.Functions.Worker.Extensions.OpenApi | NuGet [1.4.0](https://www.nuget.org/packages/Microsoft.Azure.Functions.Worker.Extensions.OpenApi/1.4.0) | | |
| Microsoft.Azure.Functions.Worker.Extensions.OpenApi | NuGet [1.4.0](https://www.nuget.org/packages/Microsoft.Azure.Functions.Worker.Extensions.OpenApi/1.4.0)<br>NuGet [2.0.0-preview1](https://www.nuget.org/packages/Microsoft.Azure.Functions.Worker.Extensions.OpenApi/2.0.0-preview1) | | |
| Microsoft.Azure.Functions.Worker.Extensions.RabbitMQ | NuGet [1.1.0](https://www.nuget.org/packages/Microsoft.Azure.Functions.Worker.Extensions.RabbitMQ/1.1.0) | | |
| Microsoft.Azure.Functions.Worker.Extensions.SendGrid | NuGet [3.0.2](https://www.nuget.org/packages/Microsoft.Azure.Functions.Worker.Extensions.SendGrid/3.0.2) | | |
| Microsoft.Azure.Functions.Worker.Extensions.ServiceBus | NuGet [5.7.0](https://www.nuget.org/packages/Microsoft.Azure.Functions.Worker.Extensions.ServiceBus/5.7.0) | | |
Expand Down Expand Up @@ -385,6 +385,7 @@
| Event Hubs - Service Fabric Processor | NuGet [0.5.4](https://www.nuget.org/packages/Microsoft.Azure.EventHubs.ServiceFabricProcessor/0.5.4) | | GitHub [0.5.4](https://github.com/Azure/azure-sdk-for-net/tree/Microsoft.Azure.EventHubs.ServiceFabricProcessor_0.5.4/sdk/eventhub/Microsoft.Azure.EventHubs.ServiceFabricProcessor/) |
| Extensions - Caching Cosmos | NuGet [1.4.0](https://www.nuget.org/packages/Microsoft.Extensions.Caching.Cosmos/1.4.0) | | GitHub [1.4.0](https://github.com/Azure/Microsoft.Extensions.Caching.Cosmos/tree/v1.0.0-preview4) |
| Face | NuGet [2.8.0-preview.3](https://www.nuget.org/packages/Microsoft.Azure.CognitiveServices.Vision.Face/2.8.0-preview.3) | | GitHub [2.8.0-preview.3](https://github.com/Azure/azure-sdk-for-net/tree/Microsoft.Azure.CognitiveServices.Vision.Face_2.6.0-preview.1/sdk/cognitiveservices/Vision.Face) |
| File Shares | NuGet [11.2.3](https://www.nuget.org/packages/Microsoft.Azure.Storage.File/11.2.3) | | GitHub [11.2.3](https://github.com/Azure/azure-storage-net/tree/master/File) |
| Form Recognizer | NuGet [0.8.0-preview](https://www.nuget.org/packages/Microsoft.Azure.CognitiveServices.FormRecognizer/0.8.0-preview) | | GitHub [0.8.0-preview](https://github.com/Azure/azure-sdk-for-net/tree/main/sdk/cognitiveservices/FormRecognizer) |
| Functions - Extensions | NuGet [1.1.0](https://www.nuget.org/packages/Microsoft.Azure.Functions.Extensions/1.1.0) | | GitHub [1.1.0](https://github.com/Azure/azure-functions-dotnet-extensions) |
| Functions extension for Azure Mobile Apps | NuGet [3.0.0-beta8](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.MobileApps/3.0.0-beta8) | | GitHub [3.0.0-beta8](https://github.com/Azure/azure-webjobs-sdk-extensions/tree/v3.0.0-beta8/src/WebJobs.Extensions.MobileApps) |
Expand All @@ -404,8 +405,8 @@
| Functions extension for Twilio | NuGet [3.0.2](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.Twilio/3.0.2) | | GitHub [3.0.2](https://github.com/Azure/azure-webjobs-sdk-extensions/tree/v3.0.0/src/WebJobs.Extensions.Twilio) |
| Functions extension metadata generator | NuGet [4.0.1](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Script.ExtensionsMetadataGenerator/4.0.1) | | GitHub [4.0.1](https://github.com/Azure/azure-functions-host) |
| Functions item template pack for Microsoft Template Engine | NuGet [4.0.2288](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.ItemTemplates/4.0.2288) | | GitHub [4.0.2288](https://github.com/Azure/azure-functions-templates/tree/3.1.1582) |
| Functions OpenAPI app settings deserialization library | NuGet [1.4.0](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.OpenApi.Configuration.AppSettings/1.4.0) | | |
| Functions OpenAPI document and Swagger UI renderer library | NuGet [1.4.0](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.OpenApi/1.4.0) | | |
| Functions OpenAPI app settings deserialization library | NuGet [1.4.0](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.OpenApi.Configuration.AppSettings/1.4.0)<br>NuGet [2.0.0-preview1](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.OpenApi.Configuration.AppSettings/2.0.0-preview1) | | |
| Functions OpenAPI document and Swagger UI renderer library | NuGet [1.4.0](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.OpenApi/1.4.0)<br>NuGet [2.0.0-preview1](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.OpenApi/2.0.0-preview1) | | |
| Functions project template pack for Microsoft Template Engine | NuGet [4.0.2288](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.ProjectTemplates/4.0.2288) | | GitHub [4.0.2288](https://github.com/Azure/azure-functions-templates/tree/3.1.1582) |
| Functions runtime assemblies for App Insights logging | NuGet [3.0.33](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Logging.ApplicationInsights/3.0.33) | | GitHub [3.0.33](https://github.com/Azure/azure-webjobs-sdk/tree/v3.0.18/src/Microsoft.Azure.WebJobs.Logging.ApplicationInsights) |
| Functions runtime assemblies for logging | NuGet [4.0.2](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Logging/4.0.2) | | GitHub [4.0.2](https://github.com/Azure/azure-webjobs-sdk/tree/dev/src/Microsoft.Azure.WebJobs.Logging) |
Expand Down Expand Up @@ -487,10 +488,9 @@
| SQL Database Elastic Scale Client | NuGet [2.3.0](https://www.nuget.org/packages/Microsoft.Azure.SqlDatabase.ElasticScale.Client/2.3.0) | | GitHub [2.3.0](https://github.com/Azure/elastic-db-tools/tree/v2.3.0/Src/ElasticScale.Client) |
| SQL Database Elastic Scale Service SplitMerge | NuGet [1.2.0](https://www.nuget.org/packages/Microsoft.Azure.SqlDatabase.ElasticScale.Service.SplitMerge/1.2.0) | | |
| SQL Database Jobs | NuGet [0.8.3362.1](https://www.nuget.org/packages/Microsoft.Azure.SqlDatabase.Jobs/0.8.3362.1) | | |
| Storage - File Shares | NuGet [11.2.3](https://www.nuget.org/packages/Microsoft.Azure.Storage.File/11.2.3) | | GitHub [11.2.3](https://github.com/Azure/azure-storage-net/tree/master/File) |
| Storage APIs for Microsoft.Azure.WebJobs.Host | NuGet [4.0.4](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Host.Storage/4.0.4)<br>NuGet [5.0.0-beta.1](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Host.Storage/5.0.0-beta.1) | | GitHub [4.0.4](https://github.com/Azure/azure-webjobs-sdk/tree/storage-v4.0.1/src/Microsoft.Azure.WebJobs.Host.Storage) |
| Supporting library for Microsoft.Azure.WebJobs | NuGet [3.0.33](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Core/3.0.33) | | GitHub [3.0.33](https://github.com/Azure/azure-webjobs-sdk/tree/v3.0.18) |
| Supporting library for Microsoft.Azure.WebJobs.Extensions.OpenApi | NuGet [1.4.0](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core/1.4.0) | | |
| Supporting library for Microsoft.Azure.WebJobs.Extensions.OpenApi | NuGet [1.4.0](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core/1.4.0)<br>NuGet [2.0.0-preview1](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core/2.0.0-preview1) | | |
| Supporting library for testing Microsoft.Azure.WebJobs.Host | NuGet [3.0.30](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Host.TestCommon/3.0.30) | | GitHub [3.0.30](https://github.com/Azure/azure-webjobs-sdk) |
| Synapse | NuGet [0.1.0-preview](https://www.nuget.org/packages/Microsoft.Azure.Synapse/0.1.0-preview) | | GitHub [0.1.0-preview](https://github.com/Azure/azure-sdk-for-net/tree/Microsoft.Azure.Synapse_0.1.0-preview/sdk/synapse/Microsoft.Azure.Synapse/) |
| Tables | NuGet [2.0.0-preview](https://www.nuget.org/packages/Microsoft.Azure.Cosmos.Table/2.0.0-preview) | | |
Expand Down
130 changes: 130 additions & 0 deletions docs/fundamentals/code-analysis/style-rules/ide0130.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
---
title: "IDE0130: Namespace does not match folder structure"
description: "Learn about code analysis rule IDE0130: Namespace does not match folder structure"
ms.date: 12/05/2022
ms.topic: reference
f1_keywords:
- IDE0130
- dotnet_style_namespace_match_folder
helpviewer_keywords:
- IDE0130
- dotnet_style_namespace_match_folder
author: gewarren
ms.author: gewarren
dev_langs:
- CSharp
- VB
---
# Namespace does not match folder structure (IDE0130)

| Property | Value |
| ------------------------ | ------------------------------------------------------ |
| **Rule ID** | IDE0130 |
| **Title** | Namespace does not match folder structure |
| **Category** | Style |
| **Subcategory** | Language rules (Namespace naming preferences) |
| **Applicable languages** | C# and Visual Basic |
| **Options** | `dotnet_style_namespace_match_folder` |

## Overview

This style rule uses the folder structure of the project to enforce namespace naming requirements.

## Options

Options specify the behavior that you want the rule to enforce. For information about configuring options, see [Option format](language-rules.md#option-format).

### dotnet_style_namespace_match_folder

| Property | Value | Description |
| ------------------------ | ---------------------------------------------------- | -------------------------------------------------- |
| **Option name** | dotnet_style_namespace_match_folder | |
| **Option values** | `true` | Prefer namespace naming to match folder structure. |
| | `false` | Disables the rule. |
| **Default option value** | `true` | |

> [!NOTE]
> 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:
>
> ```ini
> is_global=true
> build_property.ProjectDir = <root directory>
> build_property.RootNamespace = <root namespace>
> ```

## Example

Assume that the following code snippets are from a file named `Data/Example.cs` or `Data/Example.vb`, where `Data` represents the folder structure from the project file. The folder structure naming is added to the root namespace, which in this example is `Root`.

```csharp
// Code with violations
namespace Root.BadExample
{
class Example
{
public void M()
{
}
}
}

// Fixed code
namespace Root.Data
{
class Example
{
public void M()
{
}
}
}
```

```vb
' Code with violations
Namespace Root.BadExample
Class Example
Public Sub M()
End Sub
End Class
End Namespace

' Fixed code
Namespace Root.Data
Class Example
Public Sub M()
End Sub
End Class
End Namespace
```

## Suppress a warning

If you want to suppress only a single violation, add preprocessor directives to your source file to disable and then re-enable the rule.

```csharp
#pragma warning disable IDE0130
// The code that's violating the rule is on this line.
#pragma warning restore IDE0130
```

To disable the rule for a file, folder, or project, set its severity to `none` in the [configuration file](../configuration-files.md).

```ini
[*.{cs,vb}]
dotnet_diagnostic.IDE0130.severity = none
```

To disable all of the code-style rules, set the severity for the category `Style` to `none` in the [configuration file](../configuration-files.md).

```ini
[*.{cs,vb}]
dotnet_analyzer_diagnostic.category-Style.severity = none
```

For more information, see [How to suppress code analysis warnings](../suppress-warnings.md).

## See also

- [Language rules](language-rules.md)
- [Code style rules reference](index.md)
1 change: 1 addition & 0 deletions docs/fundamentals/code-analysis/style-rules/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ The following table list all the code-style rules by ID and [options](../code-st
> | [IDE0090](ide0090.md) | Simplify `new` expression | [csharp_style_implicit_object_creation_when_type_is_apparent](ide0090.md#csharp_style_implicit_object_creation_when_type_is_apparent) |
> | [IDE0100](ide0100.md) | Remove unnecessary equality operator | |
> | [IDE0110](ide0110.md) | Remove unnecessary discard | |
> | [IDE0130](ide0130.md) | Namespace does not match folder structure | [dotnet_style_namespace_match_folder](ide0130.md#dotnet_style_namespace_match_folder) |
> | [IDE0140](ide0140.md) | Simplify object creation | [visual_basic_style_prefer_simplified_object_creation](ide0140.md#visual_basic_style_prefer_simplified_object_creation) |
> | [IDE0150](ide0150.md) | Prefer `null` check over type check | [csharp_style_prefer_null_check_over_type_check](ide0150.md#csharp_style_prefer_null_check_over_type_check) |
> | [IDE0160](ide0160-ide0161.md) | Use block-scoped namespace | [csharp_style_namespace_declarations](ide0160-ide0161.md#csharp_style_namespace_declarations) |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ The style rules in this section are applicable to both C# and Visual Basic.
- [Use null propagation (IDE0031)](ide0031.md)
- [Use 'is null' check (IDE0041)](ide0041.md)
- [File header preferences](ide0073.md)
- [Namespace naming preferences](ide0130.md)

## C# style rules

Expand Down
4 changes: 4 additions & 0 deletions docs/fundamentals/toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1678,6 +1678,10 @@ items:
items:
- name: IDE0073
href: code-analysis/style-rules/ide0073.md
- name: Namespace naming preferences
items:
- name: IDE0130
href: code-analysis/style-rules/ide0130.md
- name: Unnecessary code rules
items:
- name: Overview
Expand Down