【问题标题】:Blazor client WASM launch configuration for VSCodeVSCode 的 Blazor 客户端 WASM 启动配置
【发布时间】:2020-07-27 21:28:36
【问题描述】:

在哪里可以找到 .NET Core Launch(Blazor Standalone)启动配置的示例?在你把我推荐给这个https://docs.microsoft.com/en-us/aspnet/core/blazor/debug?tabs=visual-studio-code&view=aspnetcore-3.1#vscode之前,我已经去过那里了。没有配置文件的实际示例。

【问题讨论】:

  • 这里也一样。 仍然完全按照所引用的链接文章所说的那样做。 '.NET Core Launch (Blazor Standalone)''.NET Core Debug Blazor Web Assembly in Chrome' 缺失
  • 谢谢,很高兴知道我不是唯一一个迷路的人。

标签: visual-studio-code blazor-client-side


【解决方案1】:

我也为此苦苦挣扎;使用“.Net Core”进行调试应该是首选;应该自动生成:

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": ".NET Core Launch (Blazor Standalone)",
            "type": "coreclr",
            "request": "launch",
            "program": "dotnet",
            "args": [
                "run"
            ],
            "cwd": "${workspaceFolder}/src/Project.UI",
            "env": {
                "ASPNETCORE_ENVIRONMENT": "Development"
            }
        },
        {
            "name": ".NET Core Debug Blazor Web Assembly in Chrome",
            "type": "pwa-chrome",
            "request": "launch",
            "timeout": 30000,
            "url": "https://localhost:5001",
            "webRoot": "${workspaceFolder}/src/Project.UI",
            "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}"
        }
    ]
}

【讨论】:

  • 我的 Blazor 项目位于“/src/Project.UI”中
  • 非常感谢!
  • "${workspaceFolder}/src/Project.UI"替换为您的项目位置
【解决方案2】:

您需要先为 blazor WebAssembly 创建一个构建任务 (task.json)

   {
   // See https://go.microsoft.com/fwlink/?LinkId=733558
   // for the documentation about the tasks.json format
   "version": "2.0.0",
   "tasks": [
      {
         "label": "build",
         "command": "dotnet",
         "type": "process",
         "args": [
            "build",
            "${workspaceFolder}/BlazorSVgTest.csproj",
            "/property:GenerateFullPaths=true",
            "/consoleloggerparameters:NoSummary"
         ],
         "problemMatcher": "$msCompile"
      },
   ]
}

然后创建一个启用调试的启动任务(launch.json)

{
   // See https://go.microsoft.com/fwlink/?LinkId=733558
   // for the documentation about the tasks.json format
   "version": "2.0.0",
   "tasks": [
      {
         "label": "build",
         "command": "dotnet",
         "type": "process",
         "args": [
            "build",
            "${workspaceFolder}/BlazorSVgTest.csproj",
            "/property:GenerateFullPaths=true",
            "/consoleloggerparameters:NoSummary"
         ],
         "problemMatcher": "$msCompile"
      },
   ]
}

【讨论】:

    猜你喜欢
    • 2021-02-27
    • 1970-01-01
    • 2021-04-05
    • 2020-05-17
    • 1970-01-01
    • 2021-11-06
    • 1970-01-01
    • 2021-02-24
    • 2020-04-24
    相关资源
    最近更新 更多