Skip to content

Fix intermittent circular dependency build failure#65667

Merged
wtgodbe merged 2 commits intomainfrom
wtgodbe/intermittent
Mar 6, 2026
Merged

Fix intermittent circular dependency build failure#65667
wtgodbe merged 2 commits intomainfrom
wtgodbe/intermittent

Conversation

@wtgodbe
Copy link
Member

@wtgodbe wtgodbe commented Mar 5, 2026

We occasionally see failures like:

/Users/runner/work/1/s/.packages/microsoft.dotnet.sharedframework.sdk/10.0.0-beta.26154.121/targets/sharedfx.targets(581,5): error MSB4006: There is a circular dependency in the target dependency graph involving target "GetFilesToPublish". [/Users/runner/work/1/s/src/Framework/App.Runtime/src/

The root cause of this is that PublishToSharedLayoutRoot calls MSBuild on its own process, which then calls GetFilesToPublish, which again MSbuild's itself, but removes the setting of OutputPath from line 141. So the inner-inner build has the same global properties as the outer build, which MSBuild detects as a circular dependency. If we set an arbitrary sentinel property in the MSBuild invocation in PublishToSharedLayoutRoot, then the global properties will no longer match.

https://github.com/dotnet/dotnet/blob/856f69955c79a685a753283ea03701c4d04264ba/src/arcade/src/Microsoft.DotNet.SharedFramework.Sdk/targets/sharedfx.targets#L578-L583

Copilot AI review requested due to automatic review settings March 5, 2026 22:45
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a sentinel MSBuild property to the PublishToSharedLayoutRoot self-invocation to prevent MSBuild from treating nested builds as having identical global properties (avoiding an intermittent circular target dependency failure).

Changes:

  • Updates the PublishToSharedLayoutRoot target’s MSBuild invocation to include a sentinel property (_PublishingToLayout=true).

….sfxproj

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@wtgodbe wtgodbe added the area-infrastructure Includes: MSBuild projects/targets, build scripts, CI, Installers and shared framework label Mar 5, 2026
@wtgodbe
Copy link
Member Author

wtgodbe commented Mar 5, 2026

/backport to release/10.0

@github-actions
Copy link
Contributor

github-actions bot commented Mar 5, 2026

Started backporting to release/10.0 (link to workflow run)

@wtgodbe wtgodbe merged commit e3bebf7 into main Mar 6, 2026
25 checks passed
@wtgodbe wtgodbe deleted the wtgodbe/intermittent branch March 6, 2026 01:10
@dotnet-policy-service dotnet-policy-service bot added this to the 11.0-preview3 milestone Mar 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-infrastructure Includes: MSBuild projects/targets, build scripts, CI, Installers and shared framework

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants