Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4839

ASP.NET Core 8 and Blazor Web Assembly application runtimeconfig

$
0
0

I am following this tutorial https://dotnet.microsoft.com/en-us/learn/aspnet/blazor-tutorial/run which builds a very basic Blazor app. However the project won't run on ASP.NET Core 8. Could you please help find out why the <app>runtimeconfig.json file does not get generated when the Blazor project is built? This is needed because otherwise the project won't run. The project is built successfully but I can not run it.

The error that I get is:

WasmAppHost --use-staticwebassets --runtime-config runtimeconfig.json
Error: Cannot find runtime config at /bin/Debug/net8.0/

I have tried setting the property GenerateRuntimeConfigDevFile to true in the .csproj file as described here: https://learn.microsoft.com/en-us/dotnet/core/runtime-config/

but still the json file does not get created.

I have tried manually creating it using the schema found here: https://gist.github.com/natemcmaster/0bdee16450f8ec1823f2c11af880ceeb but I get error about missing WasmHostProperties. There must be something specific to wasm applications.

I came up with this:

{"runtimeOptions": {"tfm": "net8.0","frameworks": [           {"name": "Microsoft.NETCore.App","version": "8.0.0"           },           {"name": "Microsoft.AspNetCore.App","version": "8.0.0"           }       ],"configProperties": {"System.GC.Server": true,"System.Reflection.NullabilityInfoContext.IsSupported": true,"System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": false       },"wasmHostProperties": {"webServerPort":"7238","perHostConfig": [        {"name": "wasmAppHost","host-args": ["--experimental-wasm-simd", "--experimental-wasm-eh"             ]        }    ]}}}

However I believe this file should be automatically be generated.

I am currently upgrading Visual Studio to version 17.8.2 due to a warning saying that VS version 17.7 cannot target .NET version 8 or above. Will keep you updated in case this resolves the issue with the json file.

I also get a warning regarding compiler versions, I am not sure if it is related:

Warning CS9057 The analyzer assembly 'C:\Program Files\dotnet\packs\Microsoft.AspNetCore.App.Ref\8.0.0\analyzers\dotnet\cs\Microsoft.AspNetCore.App.Analyzers.dll' references version '4.8.0.0' of the compiler, which is newer than the currently running version '4.7.0.0'. WebAppAuthorization C:\Program Files\dotnet\packs\Microsoft.AspNetCore.App.Ref\8.0.0\analyzers\dotnet\cs\Microsoft.AspNetCore.App.Analyzers.dll 1 Active

Could you please give some advice?

Thank you in advance.


Viewing all articles
Browse latest Browse all 4839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>