Skip to content

Avoid duplicate framework builds from Components E2E publishes - #68650

Merged
wtgodbe merged 3 commits into
dotnet:mainfrom
wtgodbe:fix-components-e2e-build-race
Aug 19, 2026
Merged

Avoid duplicate framework builds from Components E2E publishes#68650
wtgodbe merged 3 commits into
dotnet:mainfrom
wtgodbe:fix-components-e2e-build-race

Conversation

@wtgodbe

@wtgodbe wtgodbe commented Aug 19, 2026

Copy link
Copy Markdown
Member

Summary

Prevent Components test-asset publishes from flowing app-specific global properties into framework project references that share the repository's normal build outputs.

The workaround is intentionally limited to src/Components/Directory.Build.targets, which is repository build configuration and is not included in the Microsoft.AspNetCore.Components.Testing package.

Root cause

Windows build 1558435 failed while Negotiate.Server compiled against Microsoft.AspNetCore.Components.dll.

The binlog shows NativeAotTestApp.E2E.Tests publishing NativeAotTestApp with E2ECompileTestHarness=true and an app-specific PublishDir. Those globals flowed into Microsoft.AspNetCore.Components.csproj, creating a second MSBuild project configuration even though its output and intermediate paths were unchanged.

That second configuration recompiled Components and ran CopyRefAssembly against the shared reference assembly at 23:56:16.559. Negotiate.Server attempted to open the same file at 23:56:16.577 and failed with CS0009.

The recent fixes in #68463 and #68501 cover overlapping static-web-asset publish work, but not this property-distinct framework build from the Native AOT E2E harness.

Fix

Components test assets append these app/host-only globals to ProjectReference.UndefineProperties:

  • E2ECompileTestHarness
  • E2EAppMode
  • PublishDir
  • _E2EIsPublishing

The E2EApp=true reference from a test harness to its app is explicitly exempted. This preserves the properties that select the app's publish mode, destination, and Native AOT behavior. The properties are removed only from the harness's other dependencies and when the app traverses its own project references.

UndefineProperties is honored by ordinary MSBuild project-reference calls and static-web-assets build/publish traversals. Framework dependencies therefore reuse configurations without E2E-specific globals instead of rebuilding into shared outputs. BuildProjectReferences remains unchanged, so clean and standalone builds can still build missing dependencies.

Validation

  • Native AOT and managed harness evaluations preserve an empty UndefineProperties value on their E2EApp=true references.
  • The same apps apply the four-property removal list to generated framework and analyzer project references.
  • A standard project-reference traversal evaluates Microsoft.AspNetCore.Components.csproj without the E2E globals.
  • ResolveReferencedProjectsStaticWebAssetsConfiguration evaluates Components without the app-specific globals.
  • A PrepareE2EApps publish using the unchanged packaged targets preserves the app-specific PublishDir and E2E mode on the root app, while no Components evaluation carries any of the four E2E globals.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI lite review requested due to automatic review settings August 19, 2026 16:16
@wtgodbe
wtgodbe requested a review from a team as a code owner August 19, 2026 16:16

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

This PR aims to prevent Components E2E app publish/build invocations from creating property-distinct (and potentially concurrent) framework builds that write into shared outputs, which can lead to file lock / duplicate build issues in CI.

Changes:

  • Adds UndefineProperties when preparing E2E app ProjectReference items so host-only globals don’t distinguish app builds.
  • Adds a ProjectReference UndefineProperties default for Components test-asset projects to stop publish/harness globals from flowing into framework project references.
  • Keeps normal project-reference building behavior (e.g., BuildProjectReferences) so clean/standalone builds still restore/build dependencies.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/Components/Testing/eng/targets/Microsoft.AspNetCore.Components.Testing.targets Attempts to strip test-host properties from E2E app invocations by adding UndefineProperties to the app items.
src/Components/Directory.Build.targets Ensures Components test-asset project references undefine E2E/publish globals when traversing framework dependencies.

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

wtgodbe and others added 2 commits August 19, 2026 09:50
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@wtgodbe
wtgodbe merged commit 87d2cc9 into dotnet:main Aug 19, 2026
28 of 29 checks passed
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 12.0-preview1 milestone Aug 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants