Skip to content

Conversation

maraf
Copy link
Member

@maraf maraf commented Aug 26, 2025

Extend "TreatAsLocalProperty" to RuntimeIdentifiers, the same way as we do for RuntimeIdentifier.
Projects using BlazorWebAssembly SDK are meant to target browser-wasm only.

Contributes to dotnet/runtime#110624

@maraf maraf self-assigned this Aug 26, 2025
@maraf maraf added the Area-AspNetCore RazorSDK, BlazorWebAssemblySDK, dotnet-watch label Aug 26, 2025
Copy link
Contributor

This PR is targeting main, which is now for .NET 11-facing work. If you intended to target .NET 10, either retarget this PR to release/10.0.1xx or make sure you backport the change to release/10.0.1xx after merging. See #50394 for more details.

Copy link
Contributor

Thanks for your PR, @@maraf.
To learn about the PR process and branching schedule of this repo, please take a look at the SDK PR Guide.

@maraf maraf added this to the 11.0.1xx milestone Aug 26, 2025
@maraf maraf requested a review from baronfel August 26, 2025 20:27
@maraf maraf marked this pull request as ready for review August 26, 2025 20:27
@Copilot Copilot AI review requested due to automatic review settings August 26, 2025 20:27
@maraf maraf requested a review from a team as a code owner August 26, 2025 20:27
Copy link
Contributor

@Copilot Copilot AI left a 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 extends the BlazorWebAssembly SDK to treat RuntimeIdentifiers as a local property, similar to how RuntimeIdentifier is already handled. This ensures that Blazor WebAssembly projects consistently target only the browser-wasm runtime, preventing external settings from overriding this requirement.

Key changes:

  • Add RuntimeIdentifiers to the TreatAsLocalProperty attribute
  • Set RuntimeIdentifiers property to use the local RuntimeIdentifier value

<PropertyGroup>
<OutputType>exe</OutputType>

<RuntimeIdentifier>browser-wasm</RuntimeIdentifier>
<RuntimeIdentifiers>$(RuntimeIdentifier)</RuntimeIdentifiers>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm unsure if we should just unset the property entirely or set it to $(RuntimeIdentifier) here. Did you try it both ways? Were there any behavioral differences?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would set this explicitly to browser-wasm

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my testing I didn't find a difference

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a vague recollection of some issue when both RuntimeIdentifiers and RuntimeIdentifier were set but I can't find any details anymore. Maybe it was just when they disagreed.

@baronfel
Copy link
Member

It would be good to have a test validating the scenario from dotnet/runtime#110624.

@maraf maraf requested review from javiercn and baronfel September 3, 2025 09:34
@maraf maraf merged commit 77944c7 into dotnet:main Sep 5, 2025
27 checks passed
@maraf maraf deleted the maraf/BlazorWasmRuntimeIdentifiersLocal branch September 5, 2025 12:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-AspNetCore RazorSDK, BlazorWebAssemblySDK, dotnet-watch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants