Repository navigation
Remove the custom BuildTask base class - #17427
Merged
Merged
Conversation
…ilities.Task BuildTask (src/Common/Internal/BuildTask.cs) reimplemented what Microsoft.Build.Utilities.Task already provides, and wrapped TaskLoggingHelper in a parallel ILog/LogImportance abstraction that only forwarded calls and shadowed the standard MSBuild logging API. It was source-included into nine task projects. - Delete src/Common/Internal/BuildTask.cs (BuildTask, Log, ILog, LogImportance) and its <Compile Include> entries from the nine consuming projects. - Rebase the 54 derived tasks on Microsoft.Build.Utilities.Task, and replace ILog with TaskLoggingHelper and LogImportance with MessageImportance. - Inline the three remaining `using BuildTask = Microsoft.Build.Utilities.Task;` aliases so the BuildTask name is gone entirely. Co-authored-by: Copilot <[email protected]> Copilot-Session: be19d794-fe4f-43fe-9e6e-f6e6b13ec6e7
Contributor
There was a problem hiding this comment.
Pull request overview
This PR removes the repo’s custom BuildTask base class and its ILog/LogImportance logging abstraction, rebasing the affected MSBuild tasks onto Microsoft.Build.Utilities.Task and the standard TaskLoggingHelper/MessageImportance APIs. This simplifies the task implementation surface and reduces future friction for follow-on work like #17378 (multi-threadable task annotation).
Changes:
- Deleted
src/Common/Internal/BuildTask.csand removed all source-include<Compile Include="..\Common\Internal\BuildTask.cs" .../>references from consuming projects. - Migrated derived tasks to
Microsoft.Build.Utilities.Taskand updated logging calls fromILog/LogImportancetoTaskLoggingHelper/MessageImportance. - Updated unit test helpers that depended on the old logging abstraction.
Show a summary per file
| File | Description |
|---|---|
| src/Microsoft.DotNet.SignTool/src/SignToolTask.cs | Removes BuildTask alias; task now derives from Microsoft.Build.Utilities.Task. |
| src/Microsoft.DotNet.SignCheckTask/SignCheckTask.cs | Removes BuildTask alias; task now derives from Microsoft.Build.Utilities.Task. |
| src/Microsoft.DotNet.SharedFramework.Sdk/src/ValidateFileVersions.cs | Switches from BuildTask to MSBuild Task base. |
| src/Microsoft.DotNet.SharedFramework.Sdk/src/GenerateSharedFrameworkDepsFile.cs | Switches from BuildTask to MSBuild Task base. |
| src/Microsoft.DotNet.SharedFramework.Sdk/src/GeneratePlatformManifestEntriesFromTemplate.cs | Switches from BuildTask to MSBuild Task base. |
| src/Microsoft.DotNet.SharedFramework.Sdk/src/GeneratePlatformManifestEntriesFromFileList.cs | Switches from BuildTask to MSBuild Task base. |
| src/Microsoft.DotNet.SharedFramework.Sdk/src/CreateFrameworkListFile.cs | Switches from BuildTask to MSBuild Task base. |
| src/Microsoft.DotNet.SharedFramework.Sdk/Microsoft.DotNet.SharedFramework.Sdk.csproj | Removes source include of Common/Internal/BuildTask.cs. |
| src/Microsoft.DotNet.PackageTesting/VerifyTypes.cs | Switches from BuildTask to MSBuild Task base. |
| src/Microsoft.DotNet.PackageTesting/VerifyClosure.cs | Switches from BuildTask to MSBuild Task base; updates logging importance enum. |
| src/Microsoft.DotNet.PackageTesting/Microsoft.DotNet.PackageTesting.csproj | Removes source include of Common/Internal/BuildTask.cs. |
| src/Microsoft.DotNet.PackageTesting/GetCompatiblePackageTargetFrameworks.cs | Switches from BuildTask to MSBuild Task base. |
| src/Microsoft.DotNet.GenFacades/SourceGenerator.cs | Replaces ILog with TaskLoggingHelper. |
| src/Microsoft.DotNet.GenFacades/RoslynBuildTask.cs | Switches from BuildTask to MSBuild Task base. |
| src/Microsoft.DotNet.GenFacades/Microsoft.DotNet.GenFacades.csproj | Removes source include of Common/Internal/BuildTask.cs. |
| src/Microsoft.DotNet.GenFacades/GenPartialFacadeSourceGenerator.cs | Replaces ILog with TaskLoggingHelper in helper APIs. |
| src/Microsoft.DotNet.GenFacades/ClearAssemblyReferenceVersions.cs | Switches from BuildTask to MSBuild Task base. |
| src/Microsoft.DotNet.GenAPI/Microsoft.DotNet.GenAPI.csproj | Removes source include of Common/Internal/BuildTask.cs. |
| src/Microsoft.DotNet.GenAPI/GenAPITask.cs | Switches from BuildTask to MSBuild Task base; replaces ILog and importance enum usages. |
| src/Microsoft.DotNet.CMake.Sdk/src/GetCMakeArtifactsFromFileApi.cs | Switches from BuildTask to MSBuild Task base; updates logging importance enum. |
| src/Microsoft.DotNet.CMake.Sdk/src/CreateCMakeFileApiQuery.cs | Switches from BuildTask to MSBuild Task base; updates logging importance enum. |
| src/Microsoft.DotNet.CMake.Sdk/Microsoft.DotNet.CMake.Sdk.csproj | Removes source include of Common/Internal/BuildTask.cs. |
| src/Microsoft.DotNet.Build.Tasks.Workloads/src/Microsoft.DotNet.Build.Tasks.Workloads.csproj | Removes stale/commented source include of BuildTask.cs. |
| src/Microsoft.DotNet.Build.Tasks.TargetFramework/src/Microsoft.DotNet.Build.Tasks.TargetFramework.csproj | Removes source include of Common/Internal/BuildTask.cs. |
| src/Microsoft.DotNet.Build.Tasks.TargetFramework/src/ChooseBestTargetFrameworksTask.cs | Switches from BuildTask to MSBuild Task base. |
| src/Microsoft.DotNet.Build.Tasks.TargetFramework/src/ChooseBestP2PTargetFrameworkTask.cs | Switches from BuildTask to MSBuild Task base; replaces Log wrapper parameter with TaskLoggingHelper. |
| src/Microsoft.DotNet.Build.Tasks.Packaging/tests/TestBuildEngine.cs | Updates test build engine to use new test Log helper and MessageImportance. |
| src/Microsoft.DotNet.Build.Tasks.Packaging/tests/Log.cs | Replaces ILog test abstraction with a concrete Log helper using MessageImportance. |
| src/Microsoft.DotNet.Build.Tasks.Packaging/src/ValidationTask.cs | Switches from BuildTask to MSBuild Task base. |
| src/Microsoft.DotNet.Build.Tasks.Packaging/src/ValidateHarvestVersionIsLatestForRelease.cs | Switches from BuildTask to MSBuild Task base; updates logging importance enum. |
| src/Microsoft.DotNet.Build.Tasks.Packaging/src/ValidateFrameworkPackage.cs | Updates logging importance enum usage. |
| src/Microsoft.DotNet.Build.Tasks.Packaging/src/UpdatePackageIndex.cs | Switches from BuildTask to MSBuild Task base. |
| src/Microsoft.DotNet.Build.Tasks.Packaging/src/SplitReferences.cs | Switches from BuildTask to MSBuild Task base. |
| src/Microsoft.DotNet.Build.Tasks.Packaging/src/SplitDependenciesBySupport.cs | Switches from BuildTask to MSBuild Task base. |
| src/Microsoft.DotNet.Build.Tasks.Packaging/src/PromoteDependencies.cs | Switches from BuildTask to MSBuild Task base; updates logging importance enum. |
| src/Microsoft.DotNet.Build.Tasks.Packaging/src/NuGetUtility.cs | Replaces internal Log wrapper parameter types with TaskLoggingHelper. |
| src/Microsoft.DotNet.Build.Tasks.Packaging/src/NuGetPack.cs | Switches from BuildTask to MSBuild Task base; updates logging importance enum. |
| src/Microsoft.DotNet.Build.Tasks.Packaging/src/NuGetAssetResolver.cs | Replaces ILog with TaskLoggingHelper; updates logging importance enum. |
| src/Microsoft.DotNet.Build.Tasks.Packaging/src/Microsoft.DotNet.Build.Tasks.Packaging.csproj | Removes source include of Common/Internal/BuildTask.cs. |
| src/Microsoft.DotNet.Build.Tasks.Packaging/src/HarvestPackage.cs | Switches from BuildTask to MSBuild Task base; updates logging importance enum. |
| src/Microsoft.DotNet.Build.Tasks.Packaging/src/GetSupportedPackagesFromPackageReports.cs | Switches from BuildTask to MSBuild Task base. |
| src/Microsoft.DotNet.Build.Tasks.Packaging/src/GetPackageVersion.cs | Switches from BuildTask to MSBuild Task base. |
| src/Microsoft.DotNet.Build.Tasks.Packaging/src/GetPackageFromModule.cs | Switches from BuildTask to MSBuild Task base. |
| src/Microsoft.DotNet.Build.Tasks.Packaging/src/GetPackageDestination.cs | Switches from BuildTask to MSBuild Task base. |
| src/Microsoft.DotNet.Build.Tasks.Packaging/src/GetPackageDescription.cs | Switches from BuildTask to MSBuild Task base. |
| src/Microsoft.DotNet.Build.Tasks.Packaging/src/GetMinimumNETStandard.cs | Switches from BuildTask to MSBuild Task base. |
| src/Microsoft.DotNet.Build.Tasks.Packaging/src/GetLayoutFiles.cs | Switches from BuildTask to MSBuild Task base; updates logging importance enum. |
| src/Microsoft.DotNet.Build.Tasks.Packaging/src/GetLastStablePackage.cs | Switches from BuildTask to MSBuild Task base. |
| src/Microsoft.DotNet.Build.Tasks.Packaging/src/GetInboxFrameworks.cs | Switches from BuildTask to MSBuild Task base; updates logging importance enum. |
| src/Microsoft.DotNet.Build.Tasks.Packaging/src/GetAssemblyReferences.cs | Switches from BuildTask to MSBuild Task base. |
| src/Microsoft.DotNet.Build.Tasks.Packaging/src/GetApplicableAssetsFromPackages.cs | Switches from BuildTask to MSBuild Task base. |
| src/Microsoft.DotNet.Build.Tasks.Packaging/src/GetApplicableAssetsFromPackageReports.cs | Switches from BuildTask to MSBuild Task base. |
| src/Microsoft.DotNet.Build.Tasks.Packaging/src/GenerateRuntimeDependencies.cs | Switches from BuildTask to MSBuild Task base; updates logging importance enum. |
| src/Microsoft.DotNet.Build.Tasks.Packaging/src/GeneratePackageReport.cs | Switches from BuildTask to MSBuild Task base. |
| src/Microsoft.DotNet.Build.Tasks.Packaging/src/FilterUnknownPackages.cs | Switches from BuildTask to MSBuild Task base. |
| src/Microsoft.DotNet.Build.Tasks.Packaging/src/CreateTrimDependencyGroups.cs | Switches from BuildTask to MSBuild Task base. |
| src/Microsoft.DotNet.Build.Tasks.Packaging/src/ApplyPreReleaseSuffix.cs | Switches from BuildTask to MSBuild Task base. |
| src/Microsoft.DotNet.Build.Tasks.Packaging/src/ApplyMetaPackages.cs | Switches from BuildTask to MSBuild Task base. |
| src/Microsoft.DotNet.Build.Tasks.Packaging/src/ApplyBaseLine.cs | Switches from BuildTask to MSBuild Task base. |
| src/Microsoft.DotNet.Build.Tasks.Installers/src/StabilizeWixFileId.cs | Switches from BuildTask to MSBuild Task base. |
| src/Microsoft.DotNet.Build.Tasks.Installers/src/GenerateMsiVersion.cs | Switches from BuildTask to MSBuild Task base. |
| src/Microsoft.DotNet.Build.Tasks.Installers/src/GenerateMacOSDistributionFile.cs | Switches from BuildTask to MSBuild Task base. |
| src/Microsoft.DotNet.Build.Tasks.Installers/src/GenerateGuidFromName.cs | Switches from BuildTask to MSBuild Task base. |
| src/Microsoft.DotNet.Build.Tasks.Installers/src/GenerateCurrentVersion.cs | Switches from BuildTask to MSBuild Task base. |
| src/Microsoft.DotNet.Build.Tasks.Installers/src/ExecWithRetries.cs | Switches from BuildTask to MSBuild Task base; resolves Task.Delay naming collision. |
| src/Microsoft.DotNet.Build.Tasks.Installers/src/CreateWixCommandPackageDropBase.cs | Switches from BuildTask to MSBuild Task base; updates logging importance enum. |
| src/Microsoft.DotNet.Build.Tasks.Installers/src/CreateRpmPackage.cs | Switches from BuildTask to MSBuild Task base. |
| src/Microsoft.DotNet.Build.Tasks.Installers/src/CreateMD5SumsFile.cs | Switches from BuildTask to MSBuild Task base. |
| src/Microsoft.DotNet.Build.Tasks.Installers/src/CreateDebPackage.cs | Switches from BuildTask to MSBuild Task base. |
| src/Microsoft.DotNet.Build.Tasks.Installers/src/CreateControlFile.cs | Switches from BuildTask to MSBuild Task base. |
| src/Microsoft.DotNet.Build.Tasks.Installers/src/CreateChangelogFile.cs | Switches from BuildTask to MSBuild Task base. |
| src/Microsoft.DotNet.Build.Tasks.Installers/Microsoft.DotNet.Build.Tasks.Installers.csproj | Removes source include of Common/Internal/BuildTask.cs. |
| src/Microsoft.DotNet.Build.Tasks.FileCatalog/GenerateFileCatalog.cs | Removes BuildTask alias; task now derives from Microsoft.Build.Utilities.Task. |
| src/Common/Internal/BuildTask.cs | Deletes custom BuildTask/ILog/LogImportance implementation. |
Review details
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
- Files reviewed: 74/74 changed files
- Comments generated: 4
- Review effort level: Lite
- Remove the `using Microsoft.Build.Utilities;` directives that were not
needed, since the base type is spelled out as
`Microsoft.Build.Utilities.Task` to avoid colliding with
`System.Threading.Tasks.Task`. The using is kept only where
`TaskLoggingHelper` is named.
- Fix a pre-existing typo in a ValidateHarvestVersionIsLatestForRelease
log message ("package erreleasea." -> "package release.").
Co-authored-by: Copilot <[email protected]>
Copilot-Session: be19d794-fe4f-43fe-9e6e-f6e6b13ec6e7
Sweep of every file in this PR for using directives that no longer resolve to anything: - `using Microsoft.DotNet.Build.Tasks;` in four files. Deleting BuildTask.cs left that namespace with no types at all, so these only still compiled because sub-namespaces keep the name resolvable. - `using Microsoft.Build.Utilities;` in eleven files. These were already unused before this change; the base type is spelled out as `Microsoft.Build.Utilities.Task`, so nothing brings them back into use. Co-authored-by: Copilot <[email protected]> Copilot-Session: be19d794-fe4f-43fe-9e6e-f6e6b13ec6e7
Import Microsoft.Build.Utilities and derive from `Task` directly, rather than spelling out `Microsoft.Build.Utilities.Task`. Four files keep the fully qualified form because they also import System.Threading.Tasks: - Microsoft.DotNet.Build.Tasks.Installers/src/ExecWithRetries.cs - Microsoft.DotNet.Build.Tasks.Packaging/src/GetLastStablePackage.cs - Microsoft.DotNet.Build.Tasks.Packaging/src/UpdatePackageIndex.cs - Microsoft.DotNet.Build.Tasks.Packaging/src/ValidateHarvestVersionIsLatestForRelease.cs Since ExecWithRetries keeps the qualified base type, its Task.Delay call no longer needs qualifying either. Co-authored-by: Copilot <[email protected]> Copilot-Session: be19d794-fe4f-43fe-9e6e-f6e6b13ec6e7
AlesProkop
approved these changes
Aug 28, 2026
ViktorHofer
added a commit
to ViktorHofer/arcade
that referenced
this pull request
Aug 28, 2026
Resolves conflicts with the four extracted PRs that have since merged: dotnet#17412 (console output to build log), dotnet#17426 (unused build tasks), dotnet#17427 (BuildTask base class) and dotnet#17428 (static task state). Conflict resolution: - Base classes take main's spelling. Main derives tasks from the short `Task` with Microsoft.Build.Utilities imported, except in the four files that also import System.Threading.Tasks and therefore keep the fully qualified name. The multithreading attribute and IMultiThreadableTask from this branch are layered on top. - The three tasks deleted as dead on main stay deleted, dropping their annotations with them. - GenAPITask.LogTextWriter and several using blocks were duplicated by the automatic merge; kept main's copy in each case. Main's LogTextWriter logs from a dedicated LogPendingLine rather than overriding Flush, so an explicit Flush() no longer emits a partial line. - Kept main's wording for the GetPackageDescription cache comment and its fix for the "erreleasea" typo. Co-authored-by: Copilot <[email protected]> Copilot-Session: be19d794-fe4f-43fe-9e6e-f6e6b13ec6e7
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.
BuildTask(src/Common/Internal/BuildTask.cs) reimplemented whatMicrosoft.Build.Utilities.Taskalready provides, and wrappedTaskLoggingHelperin a parallelILog/LogImportanceabstraction that only forwarded calls while shadowing the standard MSBuild logging API. It was source-included into nine task projects.src/Common/Internal/BuildTask.cs(BuildTask,Log,ILog,LogImportance) and its<Compile Include>entries from the nine consuming projects.Microsoft.Build.Utilities.Task; replacedILogwithTaskLoggingHelperandLogImportancewithMessageImportance.using BuildTask = Microsoft.Build.Utilities.Task;aliases so theBuildTaskname is gone entirely.These types are not part of any package's public surface — the task assemblies ship outside
ref/lib, so nothing binds against them.Shrinks the diff for #17378.