Skip _ResolveBlazorWasmOutputs for .NET 11+ and move BlazorRoutingEnableRegexConstraint to SDK#53602
Open
Skip _ResolveBlazorWasmOutputs for .NET 11+ and move BlazorRoutingEnableRegexConstraint to SDK#53602
Conversation
For .NET 11+, blazor.webassembly.js is provided as a Framework static web asset from the Microsoft.AspNetCore.Components.WebAssembly package and is automatically materialized by UpdateExistingPackageStaticWebAssets. The legacy _ResolveBlazorWasmOutputs target (which reads BlazorWebAssemblyJSPath) is no longer needed. For .NET 10 and earlier, the target continues to run as before for backward compatibility.
Contributor
|
Thanks for your PR, @@javiercn. |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the Blazor WebAssembly SDK targets to stop running the legacy _ResolveBlazorWasmOutputs target for .NET 11+ builds, relying instead on Static Web Assets “Framework” assets to provide blazor.webassembly.js.
Changes:
- Added an MSBuild property
_TargetingNET110OrLaterbased onTargetFrameworkVersion. - Added a condition to
_ResolveBlazorWasmOutputsso it only runs for .NET 10 and earlier (per the PR intent). - Added explanatory comments describing the new behavior split.
src/BlazorWasmSdk/Targets/Microsoft.NET.Sdk.BlazorWebAssembly.6_0.targets
Outdated
Show resolved
Hide resolved
src/BlazorWasmSdk/Targets/Microsoft.NET.Sdk.BlazorWebAssembly.6_0.targets
Outdated
Show resolved
Hide resolved
…6_0.targets Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
The regex constraint runtime switch was previously shipped in the Microsoft.AspNetCore.Components.WebAssembly package props file. Now that the Mono WASM runtime reads configProperties from runtimeconfig.json, the switch flows natively via RuntimeHostConfigurationOption. - Add BlazorRoutingEnableRegexConstraint default (false) to SDK props - Add RuntimeHostConfigurationOption item to SDK targets
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
Updates the Blazor WebAssembly SDK to:
_ResolveBlazorWasmOutputstarget for .NET 11+ (framework assets handleblazor.webassembly.js)BlazorRoutingEnableRegexConstraintfeature (moved from the package props file)Changes
Microsoft.NET.Sdk.BlazorWebAssembly.Current.propsBlazorRoutingEnableRegexConstraintproperty default (false) — previously shipped in theMicrosoft.AspNetCore.Components.WebAssemblypackage propsMicrosoft.NET.Sdk.BlazorWebAssembly.6_0.targets_TargetingNET110OrLaterversion check property_ResolveBlazorWasmOutputswithCondition="'$(_TargetingNET110OrLater)' != 'true'"so it only runs for .NET 10 and earlierRuntimeHostConfigurationOptionitem forMicrosoft.AspNetCore.Components.Routing.RegexConstraintSupport— flows theBlazorRoutingEnableRegexConstraintvalue toruntimeconfig.jsonconfigProperties, which the Mono WASM runtime reads and applies as anAppContextswitchHow it works
For .NET 11+: The
Microsoft.AspNetCore.Components.WebAssemblypackage now uses the SWA Framework Assets system.blazor.webassembly.jsis declared withSourceType=Frameworkin the package props and automatically materialized byUpdateExistingPackageStaticWebAssets. No custom detection viaBlazorWebAssemblyJSPathis needed.For .NET 10 and earlier:
_ResolveBlazorWasmOutputscontinues to run as before, readingBlazorWebAssemblyJSPathfrom the package props file for backward compatibility.Regex constraint support: The
RuntimeHostConfigurationOptionflowsBlazorRoutingEnableRegexConstrainttoruntimeconfig.json. The Mono WASM runtime readsconfigPropertiesand passes them tomono_wasm_load_runtimeas AppContext key-value pairs, soAppContext.TryGetSwitch()works natively. The oldAssemblyMetadataAttributeworkaround in the aspnetcore repo has been removed.Companion PR
Testing
_ResolveBlazorWasmOutputs)BlazorWebAssemblyJSPathflow