我正在关注本教程https://dotnet.microsoft.com/en-us/learn/aspnet/blazor-tutorial/run,它构建了一个非常基本的 Blazor 应用程序。但是该项目无法在 ASP.NET Core 8 上运行。您能否帮忙找出为什么<app>runtimeconfig.json在构建 Blazor 项目时没有生成该文件?这是必需的,因为否则该项目将无法运行。该项目已成功构建,但我无法运行它。
我得到的错误是:
WasmAppHost --use-staticwebassets --runtime-config runtimeconfig.json
错误:无法在 /bin/Debug/net8.0/ 找到运行时配置
我尝试GenerateRuntimeConfigDevFile在文件中将属性设置为 true,.csproj如下所述: https: //learn.microsoft.com/en-us/dotnet/core/runtime-config/
但仍然没有创建 json 文件。
我尝试使用此处找到的模式手动创建它: https: //gist.github.com/natemcmaster/0bdee16450f8ec1823f2c11af880ceeb,但我收到有关缺少 WasmHostProperties 的错误。wasm 应用程序必须有一些特定的东西。
我想出了这个:
{
"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", …Run Code Online (Sandbox Code Playgroud)