Avoid duplicate framework builds from Components E2E publishes - #68650
Merged
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
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
UndefinePropertieswhen preparing E2E app ProjectReference items so host-only globals don’t distinguish app builds. - Adds a
ProjectReferenceUndefinePropertiesdefault 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.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
javiercn
approved these changes
Aug 19, 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.
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 theMicrosoft.AspNetCore.Components.Testingpackage.Root cause
Windows build 1558435 failed while
Negotiate.Servercompiled againstMicrosoft.AspNetCore.Components.dll.The binlog shows
NativeAotTestApp.E2E.TestspublishingNativeAotTestAppwithE2ECompileTestHarness=trueand an app-specificPublishDir. Those globals flowed intoMicrosoft.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
CopyRefAssemblyagainst the shared reference assembly at 23:56:16.559.Negotiate.Serverattempted 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:E2ECompileTestHarnessE2EAppModePublishDir_E2EIsPublishingThe
E2EApp=truereference 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.UndefinePropertiesis 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.BuildProjectReferencesremains unchanged, so clean and standalone builds can still build missing dependencies.Validation
UndefinePropertiesvalue on theirE2EApp=truereferences.Microsoft.AspNetCore.Components.csprojwithout the E2E globals.ResolveReferencedProjectsStaticWebAssetsConfigurationevaluates Components without the app-specific globals.PrepareE2EAppspublish using the unchanged packaged targets preserves the app-specificPublishDirand E2E mode on the root app, while no Components evaluation carries any of the four E2E globals.