diff --git a/README.md b/README.md index 93b70e3..dc94e86 100644 --- a/README.md +++ b/README.md @@ -486,7 +486,30 @@ Define `PURVIEW_SDK_EXCLUDE_EMBEDDED` only when your build already provides `Mic Certain suffixes are automatically stripped from `RootNamespace` to avoid awkward namespace names like `Acme.MyProject.Core.Something`. The current built-in stripping set is intentionally broader than the common examples and includes: -`SourceGeneration`, `SourceGenerators`, `SourceGenerator`, `ServiceDefaults`, `Infrastructure`, `Abstractions`, `ClientShared`, `Persistence`, `CodeFixers`, `DataAccess`, `Extensions`, `Generators`, `Analyzers`, `Contracts`, `Framework`, `Utilities`, `AppHost`, `Helpers`, `Library`, `Common`, `Shared`, `Infra`, `Utils`, `Core`, `Data`, `Host`, `Util`, `Lib`, `EF`, plus the known shared and shared-testing project names (`Shared*`, `SharedTesting*`). +`SourceGeneration`, `SourceGenerators`, `SourceGenerator`, `ServiceDefaults`, `Infrastructure`, `Abstractions`, `ClientShared`, `Persistence`, `CodeFixers`, `CodeFixes`, `DataAccess`, `Extensions`, `Generators`, `Analyzers`, `Contracts`, `Framework`, `Utilities`, `AppHost`, `Helpers`, `Library`, `Common`, `Shared`, `Infra`, `Utils`, `Core`, `Data`, `Host`, `Util`, `Lib`, `EF`, plus the known shared and shared-testing project names (`Shared*`, `SharedTesting*`). + +### Keeping suffixes (opt a stripped suffix back in) + +The strip list is authored as the `NamespaceRemoveSuffix` item type. To keep a suffix the SDK would +otherwise strip, remove the matching entry — this **must come after the `Sdk.props` import**, because +the items are declared there and only exist to be removed once the import has evaluated: + +```xml + + + + + + + + +``` + +This is useful for analyser/source-generator repos that deliberately name projects after the role — for +example `Purview.ZodSharp.SourceGenerators`, `Purview.ZodSharp.CodeFixers`, and `Purview.ZodSharp.CodeFixes` — +and want those roles to survive in the namespace rather than collapse into the parent `Purview.ZodSharp` +namespace. Only suffixes +present in the built-in list need removing; a suffix the SDK does not ship is already kept as-is. ### Extensions namespace rule (`PDS0002`) diff --git a/docs/wiki/Assembly-Name-Generation.md b/docs/wiki/Assembly-Name-Generation.md index 6e7bb23..2e07e15 100644 --- a/docs/wiki/Assembly-Name-Generation.md +++ b/docs/wiki/Assembly-Name-Generation.md @@ -43,10 +43,33 @@ Certain suffixes are automatically stripped from `RootNamespace` to avoid awkwar The built-in stripping set is broader than the common examples and includes: `SourceGeneration`, `SourceGenerators`, `SourceGenerator`, `ServiceDefaults`, `Infrastructure`, -`Abstractions`, `ClientShared`, `Persistence`, `CodeFixers`, `DataAccess`, `Extensions`, +`Abstractions`, `ClientShared`, `Persistence`, `CodeFixers`, `CodeFixes`, `DataAccess`, `Extensions`, `Generators`, `Analyzers`, `Contracts`, `Framework`, `Utilities`, `AppHost`, `Helpers`, `Library`, `Common`, `Shared`, `Infra`, `Utils`, `Core`, `Data`, `Host`, `Util`, `Lib`, `EF`, plus the known shared and shared-testing project names (`Shared*`, `SharedTesting*`). +### Keeping suffixes + +The strip list is authored as the `NamespaceRemoveSuffix` item type. To keep a suffix the SDK would +otherwise strip, remove the matching entry — this **must come after the `Sdk.props` import**, because +the items are declared there and only exist to be removed once the import has evaluated: + +```xml + + + + + + + + +``` + +This is useful for analyser/source-generator repos that deliberately name projects after the role — for +example `Purview.ZodSharp.SourceGenerators`, `Purview.ZodSharp.CodeFixers`, and `Purview.ZodSharp.CodeFixes` — +and want those roles to survive in the namespace rather than collapse into the parent `Purview.ZodSharp` +namespace. Only suffixes +present in the built-in list need removing; a suffix the SDK does not ship is already kept as-is. + See [Project Naming Conventions](Project-Naming-Conventions.md) and [InternalsVisibleTo](InternalsVisibleTo.md) for related naming behaviour. diff --git a/docs/wiki/Configuration-Reference.md b/docs/wiki/Configuration-Reference.md index 5fdae36..0e28633 100644 --- a/docs/wiki/Configuration-Reference.md +++ b/docs/wiki/Configuration-Reference.md @@ -33,6 +33,7 @@ See [Version Detection](Version-Detection.md) for the full resolution rules. | `DisableProjectFileNamingConventionCheck` | `false` | Set to `true` to disable the validation that requires `MyProject\MyProject.csproj` naming alignment. | | `DisableGenerateAssemblyInfoClass` | `false` | Set to `true` to disable the generated `AssemblyInfo` helper source. | | `AutoIncludeUsings` | `true` | Controls SDK-added global usings for `NamespacePrefix` and `RootNamespace`. | +| `NamespaceRemoveSuffix` | *(built-in list)* | Item type listing the suffixes stripped from `RootNamespace`. Remove an entry **after** the `Sdk.props` import to keep that suffix in the namespace, e.g. ``. See [Namespace stripping](Assembly-Name-Generation.md#namespace-stripping). | ## Repository metadata diff --git a/src/src/BuildSdk/Sdk/Sdk.props b/src/src/BuildSdk/Sdk/Sdk.props index 7c9fe9e..3985fd2 100644 --- a/src/src/BuildSdk/Sdk/Sdk.props +++ b/src/src/BuildSdk/Sdk/Sdk.props @@ -46,6 +46,7 @@ + diff --git a/templates/Directory.Build.props b/templates/Directory.Build.props index cecb9b8..7dc2d28 100644 --- a/templates/Directory.Build.props +++ b/templates/Directory.Build.props @@ -26,4 +26,15 @@ + +