Keep WebView modules fallback project-local - #68281
Open
PureWeen wants to merge 1 commit into
Open
Conversation
Prevent Razor class library fallbacks from flowing into referencing WebView apps and colliding with the app-owned modules manifest. Add direct-reference regression coverage and harden the consumer-build feed handling. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4bdabca4-54b7-4e91-b94f-a51598a74d0f
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adjusts the WebView _framework/blazor.modules.json fallback static web asset so it remains available to each direct consumer project while preventing a library-owned fallback from flowing across ProjectReference boundaries and causing duplicate-asset conflicts during static web assets aggregation.
Changes:
- Change the WebView modules fallback asset authoring from
AssetMode="All"toAssetMode="CurrentProject"to prevent project-reference propagation. - Add end-to-end publish tests covering the direct app + direct RCL WebView-reference graphs (with and without RCL JS modules) to validate a single manifest is produced/served.
- Make consumer test build infrastructure more robust by omitting a non-existent local package source and tightening “network failure” detection so missing local sources don’t cause silent skips.
Show a summary per file
| File | Description |
|---|---|
| src/Components/WebView/WebView/src/StaticWebAssets.Groups.targets | Keeps the modules-manifest fallback scoped to the current project to avoid cross-project duplicate assets. |
| src/Components/WebView/test/StaticWebAssets/WebViewBuildBehaviorTests.cs | Adds publish-behavior coverage for app+RCL graphs where both reference WebView, asserting exactly one served/published manifest. |
| src/Components/WebView/test/StaticWebAssets/ConsumerBuild.cs | Improves hermetic consumer build setup by conditionally adding local feeds and refining network-failure skip detection. |
Review details
Tip
Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
- Files reviewed: 3/3 changed files
- Comments generated: 0
- Review effort level: Lite
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.
Keep WebView modules fallback project-local
Keep the WebView modules fallback from flowing across project references.
Description
The conditional fallback introduced by #67375 and backported in #67401 correctly avoids colliding with an app-generated
blazor.modules.jsonwhen a single consumer contributes JS modules. A remaining multi-project graph can still produce two fallbacks:Microsoft.AspNetCore.Components.WebView.Both projects independently materialize the package's raw
build/blazor.modules.json. Because the fallback was authored withAssetMode="All", the RCL asset flows across the project-reference boundary asSourceType=Project, SourceId=rcl. It then conflicts with the app's independently materializedSourceType=Discovered, SourceId=appasset at_framework/blazor.modules.json.This changes the fallback to
AssetMode="CurrentProject". That keeps the fallback available to each direct consumer while preventing a library-owned fallback from flowing into referencing projects. It matches the SDK's own build and publish JS-module manifests, which are also current-project-only. SDK conflict detection remains strict; the malformed duplicate is prevented at the package-authoring boundary rather than suppressed during aggregation.The build-behavior coverage now includes the exact direct/direct no-module graph and a sibling graph where the directly-referencing RCL contributes a JS module. The consumer-build helper also omits an optional local package source when its directory does not exist and narrows network-failure detection so a missing local source cannot silently skip product assertions.
Validation
The exact new no-module assertion failed before the product change with:
After changing the fallback to
CurrentProject, the same assertion passes and publishes one empty[]manifest.All five
WebViewBuildBehaviorTestspass against currentmain, covering:Related context: #67375, #67401, and dotnet/sdk#54779.