-
Notifications
You must be signed in to change notification settings - Fork 1.2k
[Blazor] Compute _BlazorJSFile
for _ReplaceFingerprintedBlazorJsForPublish
#50943
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This PR is targeting |
There was a problem hiding this comment.
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 fixes an issue with fingerprinted Blazor JS file replacement when a Blazor WebAssembly project is referenced from an ASP.NET Core server project. The fix ensures proper computation of _BlazorJSFile
and modifies the static web asset handling to prevent asset conflicts during the publish process.
- Refactors
_BlazorJSFile
computation into a separate target for better dependency management - Modifies asset kind handling to use
Build
for fingerprinted assets andPublish
for replacement assets - Adds comprehensive test coverage for both fingerprinted and non-fingerprinted scenarios
Reviewed Changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated no comments.
File | Description |
---|---|
src/BlazorWasmSdk/Targets/Microsoft.NET.Sdk.BlazorWebAssembly.6_0.targets | Core fix - refactors JS file resolution and asset kind handling for proper fingerprinting |
test/Microsoft.NET.Sdk.BlazorWebAssembly.Tests/WasmPublishIntegrationTest.cs | Adds test method to verify the fix works for both fingerprinted and non-fingerprinted scenarios |
test/TestAssets/TestProjects/BlazorWasmReferencedByAspNetCoreServer/* | Complete test project structure with server and client projects to reproduce the issue |
/backport to release/10.0.1xx |
Started backporting to release/10.0.1xx: https://github.com/dotnet/sdk/actions/runs/17882989747 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes look good. One question that I had is, doesn't the original repro include a PWA? I'm curious as to why this scenario failed and other similar scenarios on the tests didn't.
What's special about this asset configuration?
The original repro contained PWA, but the failure was happening without it as well. I'm not sure if test Blazor Wasm referenced by AspNetCore server and doing publish. |
Closed in favor of #50949 |
When Blazor Wasm project is referenced from an AspNetCore server project, we need to compute
_BlazorJSFile
to correctly replace StaticWebAssets_ReplaceFingerprintedBlazorJsForPublish
.To mitigate that the Server project already contains assets for blazor.js from build (and removing them inside of the nested build isn't enough), we define the SWA for blazor.js AssetKind=Build and AssetKind=Publish if fingerprinting is enabled.
This needs to be backported to .NET 10.
Fixes dotnet/runtime#119886