Commit 6bd759a
* [Blazor] Model WebView blazor.modules.json as a framework asset (#67374)
Microsoft.AspNetCore.Components.WebView shipped its fallback blazor.modules.json
via a static web asset group (BlazorWebViewModules=fallback) plus manifest-promotion
targets. At publish, group filtering runs with SkipDeferred=true, so the fallback was
not excluded and GenerateStaticWebAssetEndpointsManifest saw two AssetKind=All assets
on _framework/blazor.modules.json, throwing 'Sequence contains more than one element'
in MAUI Blazor Hybrid apps that also reference a JS-module-contributing RCL.
Model blazor.modules.json as a framework static web asset (like
Microsoft.AspNetCore.Components.WebAssembly ships its JS): BasePath '/', assets under
wwwroot/_framework/, and StaticWebAssetFrameworkPattern '**/*.js;**/*.modules.json'.
The framework pattern is matched against the fingerprinted relative path, so a suffix
glob (*.modules.json) is required for the JS module manifest to be classified as a
Framework asset. The deferred BlazorWebViewModules group + promotion targets are
removed; a minimal StaticWebAssets.Groups.targets keeps JSModuleManifestRelativePath
and CompressionEnabled for consumers.
Add a test project that cracks the built .nupkg files and asserts the static web assets
layout/shape for the WebView, WebAssembly, App.Internal.Assets and Identity.UI packages,
plus end-to-end build/publish tests that reference the locally-built WebView package
from a generated app (and a JS-module RCL) and validate the produced endpoints.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Fix WebView ProjectReference publish conflict and improve packaging tests
The framework-asset modeling of blazor.modules.json/blazor.webview.js broke publish for
in-repo projects that reference the WebView project via ProjectReference (the WebView E2E
test and the Photino sample): the SDK applies StaticWebAssetFrameworkPattern when computing
a referenced project's BUILD static web assets but not its PUBLISH assets, so publish ends up
with both the materialized framework asset (SourceType=Discovered, SourceId=consumer) and the
original (SourceType=Project, SourceId=WebView) at the same _framework/... target path and
fails with 'Conflicting assets with the same target path'.
Add a no-op-for-package-consumers workaround in StaticWebAssets.Groups.targets that drops the
redundant Project-sourced WebView framework assets at publish (the materialized copies are the
ones served), and import the groups targets from the WebView E2E test so it (like the Photino
sample) also gets JSModuleManifestRelativePath. Package consumers receive these assets as
SourceType=Package, so nothing is removed for them.
Test improvements:
- Build-behavior tests now create working folders under artifacts/tmp instead of the system
temp folder.
- Each build/publish captures a binary log under artifacts/log so CI collects it and failures
can be diagnosed; the working folder is preserved on failure and removed on success.
- Tests log the dotnet invocation, output and binlog path via ITestOutputHelper.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Add ProjectReference (P2P) publish regression test for WebView framework assets
Adds Publish_ProjectReferenceToWebViewWithJsModuleRcl_SucceedsWithSingleModulesManifest,
which references the WebView source project (not the package) plus a JS-module RCL and runs
'dotnet publish'. This is the exact in-repo scenario that regressed in CI: without the
StaticWebAssets.Groups.targets workaround it fails with 'Conflicting assets with the same
target path _framework/blazor.modules.json'. The test asserts publish succeeds, a single
_framework/blazor.modules.json endpoint is produced, and the app's generated manifest (with
the RCL module) supersedes the WebView fallback.
ConsumerBuild gains an isolateNuGetFeeds option so P2P builds inherit the repo NuGet.config
(needed to build the referenced source project) instead of the isolated package feed used by
the PackageReference tests.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Use deferred static web asset group for WebView modules.json (rely on dotnet/sdk#54941)
Reverts the framework-asset modeling and the in-package publish workaround. With the SDK fix
in dotnet/sdk#54941 (resolved deferred static web asset groups are persisted into the build
manifest and re-applied, unscoped, when the manifest is reloaded at publish), the idiomatic
deferred-group authoring that the WebView package already uses is correct end-to-end:
blazor.modules.json is a Package static web asset in the deferred BlazorWebViewModules group,
resolved to drop the fallback when the app contributes its own JS modules and keep it
otherwise. No framework-asset hack and no package-local workaround are needed, so the WebView
product files are unchanged from main.
This PR now contributes the static web assets packaging + build/publish regression tests:
- Package-layout tests assert the deferred-group shape for WebView (modules.json = Package in
BlazorWebViewModules=fallback; webview.js = Framework) and the framework/group shapes for
Components.WebAssembly, App.Internal.Assets and Identity.UI.
- Build/publish behavior tests (package consumer and ProjectReference consumer) assert a single
_framework/blazor.modules.json endpoint and that the app's manifest supersedes the fallback.
The publish assertions are skipped until dotnet/sdk#54941 is in the repo SDK (detected via the
pre-fix 'Sequence contains more than one element' crash) so the suite stays green meanwhile.
Note: this PR depends on dotnet/sdk#54941 flowing into the repo SDK; until then the in-repo
WebView publish path (and the publish tests) require that fix.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Fix WebView blazor.modules.json publish crash via conditional fallback (#67374)
The WebView package ships a fallback _framework/blazor.modules.json (empty []) for
apps that contribute no JS library modules. Modeling it as a deferred static web
asset group required tagging/promoting the consumer's SDK-generated manifest and
depended on an SDK fix (dotnet/sdk#54941) to filter the group at publish; without
it, publish crashed with "Sequence contains more than one element" (#67374).
Replace the group authoring with conditional materialization: the package ships
the fallback raw under build/ (not as a flowing static web asset) and materializes
it as the consumer's own asset during ResolveStaticWebAssetsInputs ONLY when the
app has no JS modules of its own. The decision runs before the build manifest /
conflict check, so exactly one asset ever lands on _framework/blazor.modules.json
and there is never a conflict at build or publish. No asset groups, no consumer
manifest tagging, no SDK dependency.
Tests validate the package layout and build/publish behavior (package + P2P
consumers, with and without JS modules) by cracking the built .nupkg and running
isolated consumer builds under artifacts/ with binlog capture.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---------
Co-authored-by: Javier Calvarro Nelson <jacalvar@microsoft.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 0c6d0f4 commit 6bd759a
9 files changed
Lines changed: 936 additions & 87 deletions
File tree
- src/Components/WebView
- WebView/src
- test/StaticWebAssets
Lines changed: 9 additions & 16 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
| 14 | + | |
13 | 15 | | |
14 | | - | |
15 | | - | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
66 | | - | |
67 | | - | |
68 | | - | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
69 | 72 | | |
70 | 73 | | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
| 74 | + | |
82 | 75 | | |
83 | 76 | | |
84 | 77 | | |
| |||
Lines changed: 55 additions & 71 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
2 | 14 | | |
| 15 | + | |
3 | 16 | | |
4 | 17 | | |
5 | 18 | | |
6 | 19 | | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | 20 | | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
31 | 37 | | |
32 | | - | |
33 | | - | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
34 | 43 | | |
35 | 44 | | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
48 | 48 | | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
57 | 61 | | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
66 | 68 | | |
67 | | - | |
68 | 69 | | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
| 70 | + | |
| 71 | + | |
88 | 72 | | |
89 | 73 | | |
90 | 74 | | |
Lines changed: 209 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
0 commit comments