I have a strategy to share App.razor from RCL project with Blazor hosting apps like Blazor Webassembly standalone app as a front-end app and Blazor hybrid apps as native apps.
I placed all assets into a RCL project(RCL) including appsettings.json file in RCL/wwwroot/ and configured it as Content and Copy.
Building RCL project moved it in RCL/bin/.../wwwroot/appsettings.json.
I added Blazor Webassembly standalone app(Wasm project) into the solution, set up project reference to RCL, removed its own appsettings.json and all razor files, and changed Wasm.Program.cs as below:
builder.RootComponents.Add<RCL.App>("#app");
builder.RootComponents.Add<HeadOutlet>("head::after");
After bulding the solution, I have also checked RCL's appsettings.json is placed in Wasm/bin/../wwwroot/.
However, the problem was the file was not included in the Configuration.
So, I tried adding this line in Wasm.Program but it wouldn't work.
builder.Configuration.AddJsonFile("_content/RCL/appsettings.json");
// or
// builder.Configuration.AddJsonFile("/appsettings.json");
tried also this in Wasm/wwwroot/index.html to see if the file is downloaded to browser cache but to fail.
<head>
<link rel="import" href="_content/RCL/appsettings.json"/>
How can I achieve my goal?