Repository navigation
[release/11.0] Migrate all source files to file-scoped namespaces - #17500
Merged
ViktorHofer merged 1 commit intoSep 7, 2026
Merged
ViktorHofer merged 1 commit into
ViktorHofer merged 1 commit into
Conversation
Backport of dotnet#17470 to release/11.0. Applies the same mechanical migration: block-scoped namespace declarations are converted to file-scoped ones and the bodies are dedented. IDE0161 is enabled as an error in .editorconfig so the rule stays enforced. Where a file was byte-identical to its pre-migration counterpart on main, the already-reviewed migrated content was taken verbatim. The remaining files were converted mechanically. StaticReflectionConstants.cs declared two namespaces, so the System.Diagnostics.CodeAnalysis one was extracted into DynamicallyAccessedMembersAttribute.cs (mirroring main). src/Microsoft.DotNet.XUnitAssert is vendored xunit source that carries an explicit '#pragma warning disable IDE0161' and is intentionally left alone. No functional changes. Co-authored-by: Copilot <[email protected]> Copilot-Session: 939d3657-0375-4294-9751-1eb9a894e28a
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
It introduces at least one concrete build-breaking syntax issue (SignatureVerificationOptions ending with };) and a couple of fixable conversion fallouts (indentation and incorrect XML doc text).
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review tier: Lite
Findings: 1
New issues introduced by this change (4)
| Severity | Finding |
|---|---|
src/Microsoft.DotNet.SignCheckLibrary/Verification/SignatureVerificationOptions.cs — SignatureVerificationOptions enum ends with };, which is not valid C# syntax for an enum… |
|
src/Microsoft.DotNet.Build.Manifest/AssetManifestModel.cs — XML doc summary has a duplicated word ("not not"), which reads like a typo. |
|
src/Microsoft.DotNet.NuGetRepack/tasks/src/NuGetUtils.cs — Indentation in this file is inconsistent (members are indented too far, and the closing brace is… |
|
src/Microsoft.DotNet.XUnitExtensions.Shared/Attributes/LinuxOnlyTheoryAttribute.cs — The XML doc summary for LinuxOnlyTheoryAttribute says "Windows", which contradicts the attribute… |
What changed in this PR
Backport that mechanically migrates C# source from block-scoped namespaces (namespace X { ... }) to file-scoped namespaces (namespace X;) across the repo, and enforces the convention by making IDE0161 an error in .editorconfig.
Changes:
- Convert many
.csfiles to file-scoped namespaces (with corresponding dedent). - Add/adjust shared item includes to keep multi-namespace scenarios file-scoped-friendly.
- Update
.editorconfigto enforce file-scoped namespaces viaIDE0161as an error.
| File | Description |
|---|---|
| .editorconfig | Enforce file-scoped namespaces via IDE0161 severity and style setting. |
| src/Microsoft.DotNet.XUnitV3Extensions/tests/AlwaysFalseConditionalAssemblyTests.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.XUnitV3Extensions/tests/AlphabeticalOrderer.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.XUnitExtensions/tests/AlphabeticalOrderer.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.XUnitExtensions.Shared/XunitConstants.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.XUnitExtensions.Shared/TestRuntimes.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.XUnitExtensions.Shared/TargetFrameworkMonikers.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.XUnitExtensions.Shared/RuntimeConfiguration.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.XUnitExtensions.Shared/Microsoft.DotNet.XUnitExtensions.Shared.projitems | Add compile include needed after namespace migration. |
| src/Microsoft.DotNet.XUnitExtensions.Shared/Discoverers/TestCategoryDiscoverer.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.XUnitExtensions.Shared/Discoverers/SkipOnPlatformDiscoverer.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.XUnitExtensions.Shared/Discoverers/SkipOnCIDiscoverer.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.XUnitExtensions.Shared/Discoverers/ParallelTheoryDiscoverer.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.XUnitExtensions.Shared/Discoverers/ActiveIssueDiscoverer.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.XUnitExtensions.Shared/ConditionalDiscovererException.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.XUnitExtensions.Shared/Attributes/WindowsOnlyTheoryAttribute.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.XUnitExtensions.Shared/Attributes/WindowsOnlyFactAttribute.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.XUnitExtensions.Shared/Attributes/UnixOnlyTheoryAttribute.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.XUnitExtensions.Shared/Attributes/UnixOnlyFactAttribute.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.XUnitExtensions.Shared/Attributes/ParallelTheoryAttribute.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.XUnitExtensions.Shared/Attributes/MacOSOnlyTheoryAttribute.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.XUnitExtensions.Shared/Attributes/MacOSOnlyFactAttribute.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.XUnitExtensions.Shared/Attributes/LinuxOnlyTheoryAttribute.cs | Convert to file-scoped namespace (and adjust doc comment location). |
| src/Microsoft.DotNet.XUnitExtensions.Shared/Attributes/LinuxOnlyFactAttribute.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.XUnitExtensions.Shared/Attributes/DotNetOnlyTheoryAttribute.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.XUnitExtensions.Shared/Attributes/DotNetOnlyFactAttribute.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.XUnitConsoleRunner/src/Utility/Transform.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.XUnitConsoleRunner/src/ParallelismOption.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.XUnitConsoleRunner/src/common/AssemblyResolution/Microsoft.Extensions.DependencyModel/TargetInfo.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.XUnitConsoleRunner/src/common/AssemblyResolution/Microsoft.Extensions.DependencyModel/ResourceAssembly.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.XUnitConsoleRunner/src/common/AssemblyResolution/Microsoft.Extensions.DependencyModel/Resolution/ICompilationAssemblyResolver.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.XUnitConsoleRunner/src/common/AssemblyResolution/Microsoft.Extensions.DependencyModel/Resolution/CompositeCompilationAssemblyResolver.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.XUnitConsoleRunner/src/common/AssemblyResolution/Microsoft.Extensions.DependencyModel/IFileSystem.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.XUnitConsoleRunner/src/common/AssemblyResolution/Microsoft.Extensions.DependencyModel/IFile.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.XUnitConsoleRunner/src/common/AssemblyResolution/Microsoft.Extensions.DependencyModel/IEnvironment.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.XUnitConsoleRunner/src/common/AssemblyResolution/Microsoft.Extensions.DependencyModel/IDirectory.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.XUnitConsoleRunner/src/common/AssemblyResolution/Microsoft.Extensions.DependencyModel/IDependencyContextReader.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.XUnitConsoleRunner/src/common/AssemblyResolution/Microsoft.Extensions.DependencyModel/FileSystemWrapper.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.XUnitConsoleRunner/src/common/AssemblyResolution/Microsoft.Extensions.DependencyModel/EnvironmentWrapper.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.XUnitConsoleRunner/src/common/AssemblyResolution/Microsoft.Extensions.DependencyModel/DirectoryWrapper.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.XUnitConsoleRunner/src/common/AssemblyResolution/Microsoft.DotNet.PlatformAbstractions/Platform.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.XUnitConsoleRunner/src/common/AssemblyResolution/Microsoft.DotNet.PlatformAbstractions/ApplicationEnvironment.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.XUnitConsoleRunner/src/common/AssemblyResolution/_DiagnosticMessage.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.XliffTasks/Validation.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.XliffTasks/Tasks/TaskItemExtensions.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.XliffTasks/Tasks/BuildErrorException.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.XliffTasks/Release.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.XliffTasks/Model/XlfNames.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.XliffTasks.Tests/AssertHelper.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.SwaggerGenerator/Microsoft.DotNet.SwaggerGenerator.CodeGenerator/Modeler/TypeModel.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.SwaggerGenerator/Microsoft.DotNet.SwaggerGenerator.CodeGenerator/Modeler/PropertyModel.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.SwaggerGenerator/Microsoft.DotNet.SwaggerGenerator.CodeGenerator/Modeler/MethodGroupModel.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.SwaggerGenerator/Microsoft.DotNet.SwaggerGenerator.CodeGenerator/Modeler/KeyValuePairExtensions.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.SwaggerGenerator/Microsoft.DotNet.SwaggerGenerator.CodeGenerator/Modeler/EnumTypeModel.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.SwaggerGenerator/Microsoft.DotNet.SwaggerGenerator.CodeGenerator/Modeler/Disposable.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.SwaggerGenerator/Microsoft.DotNet.SwaggerGenerator.CodeGenerator/GeneratorOptions.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.SwaggerGenerator/Microsoft.DotNet.SwaggerGenerator.CodeGenerator/CodeFile.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.SourceBuild/tests/WriteBuildOutputPropsTests.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.SourceBuild/tasks/src/UsageReport/UsageValidationData.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.SignTool/src/ZipPart.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.SignTool/src/SigningStatus.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.SignTool/src/PEInfo.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.SignTool/src/ItemToSign.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.SignTool/src/FileSignInfoEntry.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.SignTool/src/ExecutableType.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.SignTool.Tests/StrongNameSupportHelper.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.SignCheckLibrary/Verification/UnsupportedFileVerifier.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.SignCheckLibrary/Verification/SignatureVerificationOptions.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.SignCheckLibrary/Verification/Jar/JarError.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.SignCheckLibrary/Verification/ISecurityInfoProvider.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.SignCheckLibrary/Verification/FileHeaders.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.SignCheckLibrary/Verification/DetailKeys.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.SignCheckLibrary/Verification/CabVerifier.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.SignCheckLibrary/Logging/LogVerbosity.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.SignCheckLibrary/Logging/LoggerBase.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.SignCheckLibrary/Logging/ILogger.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.SignCheckLibrary/Interop/WinTrustFileInfo.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.SignCheckLibrary/Interop/WinTrustData.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.SignCheckLibrary/Interop/WinTrust.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.SignCheckLibrary/Interop/UnionChoice.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.SignCheckLibrary/Interop/UIChoice.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.SignCheckLibrary/Interop/StateAction.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.SignCheckLibrary/Interop/RevocationChecks.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.SignCheckLibrary/Interop/PortableExecutable/ImageMagic.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.SignCheckLibrary/Interop/PortableExecutable/DllCharacteristics.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.SignCheckLibrary/FileStatus.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.SharedFramework.Sdk/src/PlatformManifestEntry.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.RemoteExecutor/src/RemoteExecutionException.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.PackageTesting/NupkgParser.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.NuGetRepack/tasks/src/NuGetUtils.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Helix/Sdk/TaskItemExtensions.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Helix/Sdk/Helpers.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Helix/Sdk/FailureCategory.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Helix/Sdk/Constants.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Helix/Sdk/BaseTask.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Helix/Sdk.Tests/Microsoft.DotNet.Helix.Sdk.Tests/NonParallelTestCollection.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Helix/JobSender/StorageHelpers/StorageRetryPolicy.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Helix/JobSender/StorageHelpers/IBlobHelper.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Helix/JobSender/StorageHelpers/IBlobContainer.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Helix/JobSender/SentJob.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Helix/JobSender/Payloads/UriPayload.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Helix/JobSender/Payloads/EmptyPayload.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Helix/JobSender/JobListEntry.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Helix/JobSender/IWorkItemDefinition.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Helix/JobSender/ISentJob.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Helix/JobSender/IPayload.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Helix/JobSender/IJobDefinitionWithType.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Helix/JobSender/IJobDefinitionWithTargetQueue.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Helix/JobSender/HelixApiExtensions.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Helix/JobMonitor/Models/WorkItemTestResults.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Helix/JobMonitor/Interfaces/IJobMonitorRunner.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Helix/JobMonitor/Interfaces/IBlobClientFactory.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Helix/JobMonitor/Interfaces/IBlobClient.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Helix/Client/CSharp/RequestUriBuilderExtensions.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Helix/Client/CSharp/IJob.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Helix/Client/CSharp/HelixApiTokenCredential.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Helix/Client/CSharp/HelixApiOptions.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/UploadedFile.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/UnknownWorkItemEvent.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/SingleSourceRequest.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/ResponseType.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/MultiSourceResponseSource.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/MultiSourceResponse.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/MultiSourceRequest.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/MachineStateChangeRequest.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/JobResultsUri.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/InvestigationResult.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/ImageInfo.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/HistoricalAnalysisItem.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/FailureReasonPart.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/FailureReason.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/Deploy1esImagesResult.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/CustomImagePrepared.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/CustomImagePreInstalled.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/BuildAggregationSource.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/BuildAggregation.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/Artifact.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/ApiError.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/AggregatedVMScalingHistory.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.GenAPI/WriterType.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.GenAPI/SyntaxWriterType.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.CodeAnalysis/DiagnosticIds.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Build.Tasks.Workloads/src/Wix/PreprocessorDefinitionNames.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Build.Tasks.Workloads/src/Wix/GuidOptions.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Build.Tasks.Workloads/src/ToolsPackPackage.wix.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Build.Tasks.Workloads/src/TemplatePackPackage.wix.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Build.Tasks.Workloads/src/SdkPackPackage.wix.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Build.Tasks.Workloads/src/PackageExtractionMethod.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Build.Tasks.Workloads/src/Msi/PayloadPackageTokens.wix.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Build.Tasks.Workloads/src/Msi/MsiProperty.wix.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Build.Tasks.Workloads/src/LibraryPackPackage.wix.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Build.Tasks.Workloads/src/FrameworkPackPackage.wix.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Build.Tasks.Workloads/src/Extensions.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Build.Tasks.Workloads/src/BuildData.wix.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Build.Tasks.Workloads.Tests/Extensions.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Build.Tasks.VisualStudio/OptProf/Json/ProductOptProfTraining.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Build.Tasks.VisualStudio/OptProf/Json/OptProfTrainingTest.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Build.Tasks.VisualStudio/OptProf/Json/OptProfTrainingConfiguration.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Build.Tasks.VisualStudio/OptProf/Json/OptProfInstrumentationArgument.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Build.Tasks.VisualStudio/OptProf/Json/OptProfFileFilteredTest.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Build.Tasks.VisualStudio/OptProf/Json/JsonSerializerExtensions.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Build.Tasks.VisualStudio/OptProf/Json/AssemblyOptProfTraining.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Build.Tasks.Packaging/src/PackageMetadata.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Build.Tasks.Packaging/src/PackageDirectory.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Build.Tasks.Packaging/src/Metadata.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Build.Tasks.Installers/src/RpmSignatureTag.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Build.Tasks.Installers/src/RpmHeaderEntryType.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Build.Tasks.Installers/src/ArEntry.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Build.Tasks.Feed/src/VersionIdentifierProxy.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Build.Tasks.Feed/src/PushOptions.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Build.Tasks.Feed/src/LaunchDebugger.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Build.Tasks.Feed/src/IAssetPublisher.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Build.Tasks.Feed/src/GetEnvProxy.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Build.Tasks.Feed/src/AzureStorageContainerAssetTokenCredentialPublisher.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Build.Tasks.Feed/src/AzureDevOpsFeedPermission.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Build.Manifest/EnumerableExtensions.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Build.Manifest/BuildModel.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Build.Manifest/BlobArtifactModel.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Build.Manifest/AssetManifestModel.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Build.Manifest/ArtifactKind.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Build.Manifest.Tests/VersionIdentifierTestAsset.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Build.Manifest.Tests/TestInputs/TestInputs.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Arcade.Validation.Tests/CommonRepoResourcesFixture.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Arcade.Sdk.Tests/Utilities/CollectionExtensions.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Arcade.Sdk.Tests/testassets/RepoWithConditionalProjectsToBuild/src/Maybe/Class1.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Arcade.Sdk.Tests/testassets/RepoWithConditionalProjectsToBuild/src/Always/Class1.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Arcade.Sdk.Tests/testassets/MinimalRepo/src/ClassLib1/Class1.cs | Convert to file-scoped namespace. |
| src/Microsoft.Cci.Extensions/Writers/Syntax/SyntaxTokenType.cs | Convert to file-scoped namespace. |
| src/Microsoft.Cci.Extensions/Writers/Syntax/SyntaxToken.cs | Convert to file-scoped namespace. |
| src/Microsoft.Cci.Extensions/Writers/Syntax/SyntaxStyle.cs | Convert to file-scoped namespace. |
| src/Microsoft.Cci.Extensions/Writers/Syntax/IStyleSyntaxWriter.cs | Convert to file-scoped namespace. |
| src/Microsoft.Cci.Extensions/Writers/IReviewCommentWriter.cs | Convert to file-scoped namespace. |
| src/Microsoft.Cci.Extensions/Writers/ICciWriter.cs | Convert to file-scoped namespace. |
| src/Microsoft.Cci.Extensions/Writers/ICciDifferenceWriter.cs | Convert to file-scoped namespace. |
| src/Microsoft.Cci.Extensions/Writers/ICciDeclarationWriter.cs | Convert to file-scoped namespace. |
| src/Microsoft.Cci.Extensions/Writers/CSharp/CSDeclarationWriter.Namespaces.cs | Convert to file-scoped namespace. |
| src/Microsoft.Cci.Extensions/Traversers/DocIdToTypeMappingTraverser.cs | Convert to file-scoped namespace. |
| src/Microsoft.Cci.Extensions/PortingHelpers.cs | Convert to file-scoped namespace. |
| src/Microsoft.Cci.Extensions/Mappings/MemberMapping.cs | Convert to file-scoped namespace. |
| src/Microsoft.Cci.Extensions/Filters/TypesOnlyMappingDifferenceFilter.cs | Convert to file-scoped namespace. |
| src/Microsoft.Cci.Extensions/Filters/IncludeAllFilter.cs | Convert to file-scoped namespace. |
| src/Microsoft.Cci.Extensions/Filters/IMappingDifferenceFilter.cs | Convert to file-scoped namespace. |
| src/Microsoft.Cci.Extensions/Filters/IDifferenceFilter.cs | Convert to file-scoped namespace. |
| src/Microsoft.Cci.Extensions/Filters/ICciFilter.cs | Convert to file-scoped namespace. |
| src/Microsoft.Cci.Extensions/Filters/DifferenceFilter.cs | Convert to file-scoped namespace. |
| src/Microsoft.Cci.Extensions/Filters/AttributesFilter.cs | Convert to file-scoped namespace. |
| src/Microsoft.Cci.Extensions/Extensions/AssemblyIdentityHelpers.cs | Convert to file-scoped namespace. |
| src/Microsoft.Cci.Extensions/Extensions/ApiKind.cs | Convert to file-scoped namespace. |
| src/Microsoft.Cci.Extensions/Extensions/AccessorType.cs | Convert to file-scoped namespace. |
| src/Microsoft.Cci.Extensions/Differs/IElementDifferenceFactory.cs | Convert to file-scoped namespace. |
| src/Microsoft.Cci.Extensions/Differs/IDiffingService.cs | Convert to file-scoped namespace. |
| src/Microsoft.Cci.Extensions/Differs/ExportDifferenceRuleAttribute.cs | Convert to file-scoped namespace. |
| src/Microsoft.Cci.Extensions/Differs/DifferenceType.cs | Convert to file-scoped namespace. |
| src/Microsoft.Cci.Extensions/Comparers/TypeDefinitionComparer.cs | Convert to file-scoped namespace. |
| src/Microsoft.Cci.Extensions/Comparers/ICciComparers.cs | Convert to file-scoped namespace. |
| src/Microsoft.Cci.Extensions/Comparers/AttributeComparer.cs | Convert to file-scoped namespace. |
| src/Common/Microsoft.Arcade.Test.Common/StubTask.cs | Convert to file-scoped namespace. |
| src/Common/Microsoft.Arcade.Common/RequestResponseHelper.cs | Convert to file-scoped namespace. |
| src/Common/Microsoft.Arcade.Common/PackageArchiveReaderFactory.cs | Convert to file-scoped namespace. |
| src/Common/Microsoft.Arcade.Common/IRetryHandler.cs | Convert to file-scoped namespace. |
| src/Common/Microsoft.Arcade.Common/IPackageArchiveReaderFactory.cs | Convert to file-scoped namespace. |
| src/Common/Microsoft.Arcade.Common/INupkgInfoFactory.cs | Convert to file-scoped namespace. |
| src/Common/Microsoft.Arcade.Common/IHelpers.cs | Convert to file-scoped namespace. |
| src/Common/Microsoft.Arcade.Common/ICommandFactory.cs | Convert to file-scoped namespace. |
| src/Common/Microsoft.Arcade.Common/ICommand.cs | Convert to file-scoped namespace. |
| src/Common/Internal/DisposeAction.cs | Convert to file-scoped namespace. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
akoeplinger
approved these changes
Sep 7, 2026
premun
approved these changes
Sep 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Backport of #17470 to
release/11.0.What
Converts all block-scoped namespace declarations to file-scoped ones and enables
IDE0161as an error in.editorconfigso the convention stays enforced.No functional changes.
How this was produced
This is not a cherry-pick — the migration touches ~1000 files and would have conflicted with essentially every one of them. Instead:
main, the already-reviewed migrated content from Migrate all source files to file-scoped namespaces #17470 was taken verbatim. (913 files)namespace X { ... }->namespace X;plus a 4-space dedent of the body. Column-0 preprocessor directives and multi-line string literal content are left untouched, matching whatmaindid. (110 files)Notes
StaticReflectionConstants.csdeclared two namespaces, so theSystem.Diagnostics.CodeAnalysisone was extracted intoDynamicallyAccessedMembersAttribute.csand registered in the shared.projitems— mirroring what Migrate all source files to file-scoped namespaces #17470 did onmain.src/Microsoft.DotNet.XUnitAssertis vendored xunit source that carries an explicit#pragma warning disable IDE0161. It is intentionally left untouched.Validation
Build.cmd -configuration Release-> Build succeeded, 0 warnings, 0 errors. SinceIDE0161is now an error, a clean build proves every compiled source uses file-scoped namespaces.release/11.0was audited: the only non-whitespace changes are the namespace declarations themselves, the.editorconfigblock, the.projitemsentry, and theStaticReflectionConstants.cssplit.