Skip to content

[Blazor] Clarify WasmApplicationEnvironmentName for build/publish scenarios #36371

@maraf

Description

@maraf

From discord communication at https://discord.com/channels/732297728826277939/732297874062311424/1440652633755881522:

Fynzie — 11:39
Hi,
DId someone encounter a change regarding blazor wasm and net10 ? it seems the blazor wasm app is no longer fetching the correct appsettings file based on the servers's environment, resulting in the wasm app to always fetch the production appsettings (default) ?
I can't find anything talking about this change even tho it's a huge one
Marek Fisera — 12:22
What blazor mode you using? Is it Blazor Web app?
Fynzie — 12:31
blazor wasm, the old template from net5 or net6, I never migrated to the blazor united and such
but according to this https://learn.microsoft.com/en-us/aspnet/core/release-notes/aspnetcore-10.0?view=aspnetcore-10.0#set-the-environment-in-standalone-blazor-webassembly-apps its seems the old way was removed entierly and you have to either drive the configuration from your backend on startup or product as many build as environments you have
What's new in ASP.NET Core in .NET 10
Learn about the new features in ASP.NET Core in .NET 10.
Image
Marek Fisera — 12:52
Yes. In .NET 10 we have removed the boot config which was the only file that was requested every time you start the app, and so there is not reliable way to pass the actual environment from server to client (by the framework)
For Blazor Web app we have a mechanism to get it to the client, because the document hosting the WebAssembly isn't static
Fynzie — 13:14
thanks for the info, I suggest to enrich the doc with this info as I this was quite unexpected (at least for me)
jacalvar — 13:20
We should clarify that there is a way to do this during build/publish?
Fynzie — 13:24
The documentation talks about WasmApplicationEnvironmentName but I believe that what most people liked in the first place was the ability for a single output build to run on any environment. I personnaly defaulted to having a publicly accessible BE endpoint that is feeding the FE configuration

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions