Skip to content

Fix intermittent circular dependency build failure#65667

Merged
wtgodbe merged 2 commits into
mainfrom
wtgodbe/intermittent
Mar 6, 2026
Merged

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

Conversation

@wtgodbe

@wtgodbe wtgodbe commented Mar 5, 2026

Copy link
Copy Markdown
Member

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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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

wtgodbe commented Mar 5, 2026

Copy link
Copy Markdown
Member Author

/backport to release/10.0

@github-actions

github-actions Bot commented Mar 5, 2026

Copy link
Copy Markdown
Contributor

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
wtgodbe added a commit to wtgodbe/dotnet that referenced this pull request May 19, 2026
The _PublishingToLayout workaround (dotnet/aspnetcore#65667) is no longer
needed now that sharedfx.targets adds differentiating properties to its
self-referencing MSBuild calls directly.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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