Repository navigation
Avoid a conditionally skipped InitialTarget in Workarounds.targets - #17329
Merged
ViktorHofer merged 1 commit intoAug 13, 2026
Merged
Conversation
NormalizeNetCoreSdkRootCasing is declared as an InitialTarget on Workarounds.targets, which aggregates into the InitialTargets of every project that imports the Arcade SDK. Its condition requires MSBuildRuntimeType == 'Full', so on non-Windows builds the target is recorded as TargetResultCode.Skipped. MSBuild's ResultsCache refuses to satisfy any build request for a configuration when one of that configuration's initial targets was skipped (see dotnet/msbuild#11753). The project is therefore rescheduled instead of being served from the cache, which costs node-wait time in the common case and turns a re-entrant build of the same configuration into an MSB4006 "circular dependency" error. The latter broke the dotnet/dotnet source-only build legs. Move the guards from the <Target> element onto the task invocation so the target always completes successfully and behaves as a no-op when the workaround does not apply. This matches the approach already used by ValidateTargetQueues in the Helix SDK and by dotnet#15743. Verified with the real Workarounds.targets: - .NET Core MSBuild, re-entrant build of one configuration: MSB4006 before, clean after. - .NET Framework MSBuild 18.10 (version clause false): task inert, target succeeds, no errors. - .NET Framework MSBuild with the version clause forced true: the NormalizeSdkRootDriveCasing task executes and produces the same NetCoreSdkRoot as before the change. Co-authored-by: Copilot <[email protected]> Copilot-Session: ff380529-d8b3-4d2d-86b8-ce0ae191bb71
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adjusts an Arcade SDK workaround InitialTarget so it no longer gets conditionally skipped (and thus recorded as TargetResultCode.Skipped) on non-Windows/non-Full MSBuild runtimes, avoiding MSBuild results-cache misses and preventing re-entrant build requests from surfacing as MSB4006 circular dependency errors.
Changes:
- Makes
NormalizeNetCoreSdkRootCasingtarget unconditional, moving all guards onto theNormalizeSdkRootDriveCasingtask invocation. - Updates and expands the in-file documentation to explain why the target must remain unconditional (MSBuild results cache behavior for initial targets).
Show a summary per file
| File | Description |
|---|---|
| src/Microsoft.DotNet.Arcade.Sdk/tools/Workarounds.targets | Makes the initial target always succeed (no-op when not applicable) to keep MSBuild’s results cache satisfiable and avoid re-entrant scheduling/circular dependency errors. |
Review details
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
- Files reviewed: 1/1 changed files
- Comments generated: 0
- Review effort level: Lite
AlesProkop
approved these changes
Aug 13, 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.
Problem
NormalizeNetCoreSdkRootCasingis declared as anInitialTargetonWorkarounds.targets:InitialTargetson an imported file aggregates into the importing project'sInitialTargets, andWorkarounds.targetsis imported by every project that uses the Arcade SDK. The target's condition requiresMSBuildRuntimeType == 'Full', so on every non-Windows build it is recorded asTargetResultCode.Skipped.MSBuild's
ResultsCache.SatisfyRequestrefuses to satisfy a build request when any of the configuration's initial targets has a skipped result:(
skippedResultsDoNotCauseCacheMissis only true under project isolation.) This has two consequences:MSB4006: There is a circular dependency in the target dependency graph. This is what broke thedotnet/dotnetsource-only build legs ([Operational Issue]: Source-build jobs failing with circular dependency in target dotnet#8275).Fix
Move the guards from the
<Target>element onto the task invocation. The target then always runs and completes successfully, behaving as a no-op when the workaround does not apply, and the results cache stays usable.This is the same approach as #15743 ("Avoiding
InitialTargetsaltogether here makes sense as it's more performant") and matchesValidateTargetQueuesin the Helix SDK, which already puts its condition on the inner task rather than on the target.A comment is added so the conditions do not get moved back onto the
<Target>element.Validation
Verified against the real
Workarounds.targets(not a synthetic copy):MSB4006NetCoreSdkRootThe third case confirms the workaround itself is unchanged on the Windows path it exists for.
Note
Two other conditional
InitialTargetsexist in the Helix SDK (ValidateOpenQueueUsage,ValidateAzurePipelinesConfiguration). They are left alone here: they are imported by very few projects, so the impact is negligible, and they are unrelated to the regression this PR addresses.