

This tells the runtime to look for the file appsettings.json in the current directory and use it as a source for configuration. SetBasePath(Directory.GetCurrentDirectory())

NET Core application typically looks something like this. Install-Package Ĭreation of a configuration object in a. Public string Galax圜luster " įinally, I installed two NuGet packages for configuration. I defined the class GalaxyInfo to map configuration. This left me with the single page Index.razor which I'd use to display an object loaded from configuration. Next, I removed everything from the BlazorWasmConfig project I wouldn't need. I started by creating the Blazor WebAssembly App BlazorWasmConfig using the template in Visual Studio 2019 (note: I'd previously installed all required dependencies as documented in Getting started in ASP.NET Core Blazor). NET Core practices for working with configuration. Load a json configuration file directly from a Blazor WASM client using typical. That's a completely valid and viable solution but I was specifically curious about loading configuration directly from a file in the Blazor client project, e.g.

I'd never had the need for that type of configuration before but it got me curious about what was possible.Īfter a little searching I discovered that configuration for Blazor WASM is typically being loaded through an HTTP GET request to a remote resource. I've been working with Blazor Client (WASM) a fair amount recently and a couple of days ago someone asked me about how to load configuration from a file. Configuration in Blazor Client (WASM) 04 March 2020
