Deprecate and restrict non-MSBuild TaskFactory implementations #12348
+235
−2
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.
This PR implements a breaking change to restrict custom task factory implementations that are not internal to MSBuild, gated behind change wave 17.16. Custom task factories are incompatible with upcoming multithreaded MSBuild improvements and have minimal known usage.
Changes Made
1. Deprecation Documentation
ITaskFactory
andITaskFactory2
interfaces explaining the restriction and its rationale2. Restriction Logic
IsBuiltInTaskFactory()
method inTaskRegistry.cs
that validates task factory names against allowed built-in factories:AssemblyTaskFactory
(default)TaskHostFactory
(out-of-process execution)CodeTaskFactory
(inline code tasks)XamlTaskFactory
(XAML-based tasks)RoslynCodeTaskFactory
(Roslyn-compiled inline tasks)MSB4279
error when custom task factories are used and change wave 17.16 is enabled3. Change Wave Integration
ChangeWaves.cs
MSBUILDDISABLEFEATURESFROMVERSION=17.16
environment variable4. Error Handling
MSB4279
with clear guidance:5. Comprehensive Testing
6. Documentation Updates
ChangeWaves.md
to document the new restriction and its purposeManual Verification
Testing confirms the implementation works correctly:
Migration Guidance
Users affected by this change should:
MSBUILDDISABLEFEATURESFROMVERSION=17.16
if immediate migration is not possibleThis change improves MSBuild's compatibility with future multithreaded improvements while maintaining backward compatibility through the change wave opt-out mechanism.
Fixes #12347.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.